Compile less files with grunt-contrib-less won't work

前端 未结 3 1446
感情败类
感情败类 2020-12-29 10:00

I\'m using Grunt for building my web project. I installed grunt-contrib-less package und added a task to my grunt.initConfig({..});



        
3条回答
  •  别那么骄傲
    2020-12-29 10:19

    The glob pattern js/base/*.css does not match any files, therefore there is no destination. Usually, tasks like this expect multiple inputs to combine into a single output. Also, bear in mind that less is a multi-task, and putting files as a child of less is not doing what you expect. (it is treating it as a target, not a src/dest map)

    If you want a 1-1 transform of .less into .css, you can use dynamic expansion. (or you can define each src/dest pair manually, but who wants to do that?)

    In your case:

    less: {
        options: {
            paths: ['js/base']
        },
        // target name
        src: {
            // no need for files, the config below should work
            expand: true,
            cwd:    "js/base",
            src:    "*.less",
            ext:    ".css"
        }
    }
    

提交回复
热议问题