带有grunt的多个LESS文件

时间:2015-10-11 20:18:32

标签: gruntjs less

我无法弄清楚如何使用grunt获取多个文件:

less: {
      dist: {
        files: {
          '<%= yeoman.app %>/styles/main.css': ['<%= yeoman.app %>/styles/main.less']
        },
        options: {
          sourceMap: true,
          sourceMapFilename: '<%= yeoman.app %>/styles/main.css.map',
          sourceMapBasepath: '<%= yeoman.app %>/',
          sourceMapRootpath: '/'
        }
      }
    },

1 个答案:

答案 0 :(得分:2)

您必须使用grunt(http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically)的扩展文件语法。例如,要编译所有lib / less / .less来构建/ css / .css:

less: {
  dist: {
    files: [{
      expand: true,
      cwd: 'lib/less',
      src: ['*.less'],
      dest: 'build/css',
      ext: '.css'
    }]
  }
},