Answer the question
In order to leave comments, you need to log in
How to include CSS from node_modules folder in Stylus Middleware?
Hello!
Stylus Middleware creates a regular css import instead of embedding the contents of the file. How to embed CSS itself?
Handler settings
app.use(stylus.middleware( {
'src': __dirname + '/styles',
'dest': __dirname + '/public/css',
compile: function(str, path) {
return stylus(str)
.include(__dirname + '/node_modules')
.set('paths', [__dirname + '/node_modules'])
.set('include-css', true)
.set('filename', path);
}
}));
app.use(express.static(path.join(__dirname, 'public')));
@require "normalize.css/normalize.css";
html
color #333
background #f3f5f8
@import "normalize.css/normalize.css";
html {
color: #333;
background: #f3f5f8;
}
Answer the question
In order to leave comments, you need to log in
Я сейчас не могу найти это в документации (что-то она у них от раза к разу все хуже), но последний раз, когда я пользовался, эта опция называлась 'include css'
— вот так, с пробелом. С дефисом это если через командную строку. Если не получится, то попробуйте еще includeCss
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question