im using stylus to my nodejs application (not express, just plain node).
Im also using nodemon
to monitor changes and apply them without restarting my app.
I have a little sh script that runs my app:
#!/bin/sh if [ -f style/*styl ]; then echo "Building *styl..." node_modules/stylus/bin/stylus -c style/*styl fi echo "Running src/app/index.js..." nodemon src/index.js
As you can see, the scripts compiles the stylus into css if found before running the application.
Is this the correct way of compiling stylus styles? Or should I use the js library within my code?
Also, as It gets compiled before running the application, changing the *styl won't get reflected without restarting the application, obviously.
Any way to achieve this? To set stylus to compile when the file is changed without restarting app?
Problem courtesy of: jviotti
When you run the
binary it bootstraps a Node.js
/ Express application for you. In its
Stylus gets referenced and activated as a middleware.
The way Stylus is configured in this scenario causes
files to automatically (!) recompile to
files once they are changed.
So no need to manually do anything.
PS: Stylus and Express - stylesheets are not re-compiled when modified
may be of interest to you.
Solution courtesy of: Golo Roden