问题
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"
}
}
},
If I just type grunt less
, in my compiled file i get the /*# sourceMappingURL=/style/app.css.map */
comment correctly.
Instead, when i run grunt
and my watch task kicks in, the /*# sourceMappingURL=/style/app.css.map */
comment is removed on compilation.
Here's my watch task for less:
watch: {
less: {
files: ['less/*.less'],
tasks: ['less', 'postcss'],
options: {
livereload: true,
nospaces: true
}
}
},
What am I doing wrong?
回答1:
it was actually the postcss
task preventing the comment to appear. fixed with
postcss: {
options: {
map: true,
来源:https://stackoverflow.com/questions/34616876/grunt-contrib-less-compilation-on-watch-task-removes-sourcemap-link