grunt-contrib-less: compilation on watch task remo

2019-09-08 12:01发布

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条回答
一纸荒年 Trace。
2楼-- · 2019-09-08 12:21

it was actually the postcss task preventing the comment to appear. fixed with

postcss: {
    options: {
      map: true,
查看更多
登录 后发表回答