adobe / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
33.27k stars 7.63k forks source link

Have a way to cause reloads for non-live server files #6600

Open njx opened 10 years ago

njx commented 10 years ago

If I'm understanding the code correctly, in Live Development we only trigger a reload when saving a non-live file if we think the browser requested it (e.g. a JS file). That won't trigger for server files that aren't actually requested by the browser. For example, if you edit a .erb view file in a Rails project, saving it won't trigger a reload.

I think we did this because there are various files you might edit that aren't related to the current page, and we don't have any way of distinguishing between the two cases. However, perhaps it would be worth having a way to specify certain file extensions as triggering a reload. It could still cause too many reloads, since you might (for example) edit a view file that's not relevant to the current page you're previewing. But it might be a useful option.

Another, lighter-weight solution might be to simply have a keyboard shortcut in Brackets that causes the attached live preview page to reload.

njx commented 10 years ago

Probably "move to backlog".

dangoor commented 10 years ago

There are some lightweight things we can do here, so I'm calling this low priority to me. I think we should do one or two lightweight things and then possibly add something to the backlog.

It shouldn't be hard to have a pref that lets the user configure files to automatically reload. Adding UI will take more work. Keyboard shortcut for reloading the live preview page is obviously easy.

dangoor commented 10 years ago

I had called this low priority, but I'm nominating it for 1.0 because I think we can likely do something cheap here and it will be a big win for people doing live development with all kinds of server side or languages outside the supported languages.

peterflynn commented 10 years ago

Reviewed - keeping in 1.0.

New suggestion: let's just refresh any time a non-live file is saved, regardless of its extension. It seems uncommon that the user would have Live Preview open but then edit an unrelated file (and be bothered if we refreshed the page anyway). Better to have the desired refresh behavior on by default rather than buried in a pref. (But if we think there are potentially annoying cases, we could add a pref to prevent refresh when saving certain file types).

redmunds commented 10 years ago

PR #8080 provides a way to manually reload from Brackets.