从节点代码编译的内联较少的源映射

时间:2013-11-01 15:23:10

标签: css node.js less source-maps

我正在研究的项目是使用代码运行less编译器。

我在从较少的文件中向已编译的css添加内联源映射时遇到问题。 从节点我们运行以下代码:

var less = require('less'),
    options = {
        strictMath: true
    };

less.render(data, options, function(err, css) {
    callback(err, css);
});

我可以添加一个选项吗? 我尝试添加sourceMap: trueoutputSourceFiles: true但没有成功。

1 个答案:

答案 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

您尝试的sourceMapoutputSourceFiles选项似乎与grunt-contrib-less相关,请参阅:https://github.com/gruntjs/grunt-contrib-less