Question

How do I get stylus to rebuild the css (including imports) automatically upon node restart and append the timestamp?

The problem as schaermu puts it:

My stylus stylesheets were always recompiled, with one exception: when using the @import directive, the imported stylesheet was NOT recompiled when a change was noticed. For that case, i always had to manually delete the stylesheet for a full re-compile.

edit: there's an issue: https://github.com/LearnBoost/stylus/issues#issue/168

Was it helpful?

Solution

When i was building my own jade/stylus based apps, i used nodemon for development. It auto-restarts on any filechanges (after considering an ignore list, see the docs).

My stylus stylesheets were always recompiled, with one exception: when using the @import directive, the imported stylesheet was NOT recompiled when a change was noticed. For that case, i always had to manually delete the stylesheet for a full re-compile.

But in all other cases, rebuilding the stylesheets worked like a charm.

P.S. i assume you are using express as your framework of choice, my experience is based on that.

OTHER TIPS

If you are using express or any connect based web framework you can use my forked compiler middleware (TJ closed my pull request so I think this will never get into the master).

https://github.com/masylum/connect/commit/6ab47b191a1ede91eae90b1608a61f0a7397b082

This adds the option to force autocompilation of CSS files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top