带有 grunt 的多个 LESS 文件

Multiple LESS files with grunt

我不知道如何使用 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: '/'
        }
      }
    },

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

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