app.use(express.compiler({ src: __dirname + '/public', enable: ['less'] }));
That's the line in my app.js that enables less
. How can I pass the { compress: true }
parameter to it?
To minify CSS, try CSSNano and csso. To minify JavaScript, try UglifyJS. The Closure Compiler is also very effective. You can create a build process that uses these tools to minify and rename the development files and save them to a production directory.
I also had this problem and thought this can be useful to share with others:
var lessMiddleware = require('less-middleware');
app.use(lessMiddleware({ src: __dirname + '/public', compress: true, optimization: 2 }));
More information and settings about the minify-process can be found in the Less-Middleware README.md
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With