I choose node-sass to compile my sass code, but what things can I do when the code is compiling?
In other words, I want make my own rules and throw custom errors in certain condition when compiling.
If you have a look for node-sass (according to 3.xx)
documentation (on the readme) - it explains how to add your own error messaging via the error
object when you render.
from documentation
var sass = require('node-sass');
sass.render({
file: scss_filename,
[, options..]
}, function(err, result) { /*...*/ });
custom error message
var sass = require('node-sass');
sass.render({
file: scss_filename,
[, options..]
}, function(err, result) {
if (err) throw new Error(err)
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.