grunt-contrib-less:监视任务上的编译删除了sourcemap链接 [英] grunt-contrib-less: compilation on watch task removes sourcemap link
本文介绍了grunt-contrib-less:监视任务上的编译删除了sourcemap链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的较少任务配置:
Here's my less task config:
less: {
development: {
options: {
compress: false,
sourceMap: true,
yuicompress: true,
sourceMapFilename: 'export/style/app.css.map',
sourceMapURL: '/style/app.css.map'
},
files: {
"export/style/app.css": "less/app.less"
}
}
},
如果我只是键入grunt less
,则在编译后的文件中,我会正确获得/*# sourceMappingURL=/style/app.css.map */
注释.
If I just type grunt less
, in my compiled file i get the /*# sourceMappingURL=/style/app.css.map */
comment correctly.
相反,当我运行grunt
并且执行监视任务时,会在编译时删除/*# sourceMappingURL=/style/app.css.map */
注释.
Instead, when i run grunt
and my watch task kicks in, the /*# sourceMappingURL=/style/app.css.map */
comment is removed on compilation.
以下是我的监视任务:
watch: {
less: {
files: ['less/*.less'],
tasks: ['less', 'postcss'],
options: {
livereload: true,
nospaces: true
}
}
},
我在做什么错了?
推荐答案
实际上是postcss
任务,阻止注释出现.用
it was actually the postcss
task preventing the comment to appear. fixed with
postcss: {
options: {
map: true,
这篇关于grunt-contrib-less:监视任务上的编译删除了sourcemap链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文