我正在研究的项目是使用代码运行less编译器。
我在从较少的文件中向已编译的css添加内联源映射时遇到问题。 从节点我们运行以下代码:
var less = require('less'),
options = {
strictMath: true
};
less.render(data, options, function(err, css) {
callback(err, css);
});
我可以添加一个选项吗?
我尝试添加sourceMap: true
和outputSourceFiles: true
但没有成功。
答案 0 :(得分:0)
从Less v 1.5开始,编译器支持以下选项
--source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map)
--source-map-rootpath=X adds this path onto the sourcemap filename and less file paths
--source-map-basepath=X Sets sourcemap base path, defaults to current working directory.
--source-map-less-inline puts the less files into the map instead of referencing them
--source-map-map-inline puts the map (and any less files) into the output css file
--source-map-url=URL the complete url and filename put in the less file
您尝试的sourceMap
和outputSourceFiles
选项似乎与grunt-contrib-less相关,请参阅:https://github.com/gruntjs/grunt-contrib-less