Closed
Bug 950915
Opened 11 years ago
Closed 11 years ago
Watch for changes to CSS files on disk for source mapped files
Categories
(DevTools :: Style Editor, defect)
DevTools
Style Editor
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 29
People
(Reporter: harth, Assigned: harth)
References
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
dcamp
:
review+
|
Details | Diff | Splinter Review |
Showing Sass and other source mapped files in the Style Editor isn't very useful if we can't live edit them and see the changes in real time.
We can watch for changes to the generated CSS and do the live update using its contents. This requires knowing the location on disk of the generated file. Right now we only know this location for sure if we're on a file:// url.
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → fayearthur
Comment 1•11 years ago
|
||
> Watch for changes to CSS files on disk
If you manage to do that for CSS files, can you do it in a generic way? In the App Manager, we'd like to get notified when the user changes code (any files) on the disk too.
Comment 2•11 years ago
|
||
Yoric, I have a feeling that we're going to be using this quite a bit in the coming months and it would be *super* handy for us to have:
OS.File.watch("file.txt", function(ev) {
console.log("file.txt changed");
});
What do you think?
Flags: needinfo?(dteller)
Comment 3•11 years ago
|
||
We want to be able to watch directories as well.
Assignee | ||
Updated•11 years ago
|
Summary: Watch for changes to CSS files on disk for source mapped files from file:// → Watch for changes to CSS files on disk for source mapped files
Assignee | ||
Comment 5•11 years ago
|
||
Here's a work in progress patch. After saving an original source to disk, this will wait 3 seconds before updating the page's live style sheet object to reflect the contents of the generated CSS file on disk.
This means you have Sass, etc. watch for changes to your file and update the generated CSS file each time it changes. This patch hopes that it takes less than 3 seconds to do this.
The 3 seconds is arbitrary, and we'd really need the file watching in bug 958280 to be correct.
Assignee | ||
Comment 6•11 years ago
|
||
At the suggestion of Joe, we can just stat the file periodically until we see that the last modification timestamp has changed. This patch implements that technique.
There's a setTimeout in the test, but it will pass without it, it's just to hit the code that would be hit if there were a real user.
Attachment #8361436 -
Attachment is obsolete: true
Attachment #8365334 -
Flags: review?(dcamp)
Comment 7•11 years ago
|
||
Comment on attachment 8365334 [details] [diff] [review]
new-watching.patch
Review of attachment 8365334 [details] [diff] [review]:
-----------------------------------------------------------------
::: browser/devtools/styleeditor/StyleSheetEditor.jsm
@@ +452,5 @@
> + /**
> + * Check to see if our linked CSS file has changed on disk, and
> + * if so, update the live style sheet.
> + */
> + checkLinkedFileForChanges: function() {
Will this behave correctly if the style editor is torn down while the timeout is active?
Attachment #8365334 -
Flags: review?(dcamp) → review+
Assignee | ||
Comment 8•11 years ago
|
||
(In reply to Dave Camp (:dcamp) from comment #7)
> > + * Check to see if our linked CSS file has changed on disk, and
> > + * if so, update the live style sheet.
> > + */
> > + checkLinkedFileForChanges: function() {
>
> Will this behave correctly if the style editor is torn down while the
> timeout is active?
Yes, the timeout is set on the style editor's window, so it'll get cancelled with the teardown.
Assignee | ||
Comment 9•11 years ago
|
||
Whiteboard: [fixed-in-fx-team]
Comment 10•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 29
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•