Closed NightMachinery closed 10 months ago
One way to implement it is file://
access from the background script, but it won't work in Firefox. In Chrome we can do it, but there's no "onchange" event so all these file URLs would have to be re-checked every second which means 36,000 checks in ten hours per one file and that's just wasteful. In Chrome we could have used Native FileSystem API but yet again it won't work in Firefox. A universal solution could be nativeMessaging
API that runs a separate external app, but none of us has been interested since Schomery tried to implement it four years ago. The idea per se is fine so the issue can stay open in case someone decides to take a stab at it.
P.S. The internal format of the files should be UserCSS, no need to reinvent the wheel.
@tophf Polling is fine if we make it sth the user activates when they want to develop. We can optionally turn it off after three hours and show a notification.
On-demand polling is already implemented, see Writing UserCSS.
On the topic of IDEs—thoughts on adding(/accepting a PR for) GhostText integration? There's some early discussion of an extension API using onConnectExternal
/onMessageExternal
. At least for userstyles, I'd gladly take Dropbox sync with live editing in VSCode over file:/// any day
Not planned? The integrated editor is slow on my side :(
It's already implemented as "live reload", see Writing UserCSS.
It would be very good if Stylus could read styles from a dir on the local filesystem, and apply the styles with hot reload. The options of a style can be put in the comments at the start of the CSS files.
For example, suppose Stylus is set to read the dir
~/userstyles/
. I put this style there as~/userstyles/x.css
:Then
Stylus
automatically applies this style onwww.google.com
domains, with hot reload when the file changes.This workflow has two major benefits:
Related: