grunt-recess是否接受全球化?我如何指定文件?

时间:2013-07-06 01:19:06

标签: gruntjs

我正在使用grunt-recess在gruntfile.js中配置凹进任务,但我无法让它工作。我做错了什么?

gruntfile中的相关部分是:

recess:{
      dev:{
        options:{
          compile:true
        },
        files:[{
                expand:true,
                cwd:'./',
                src:['<%= yeoman.less %>/**/*.less'],
                dest:['<%= yeoman.dist %>/css/'],
                ext:'.css'
            }]



      }
    }

但是咕噜声警告说:

 Running "recess:dev" (recess) task
 Warning: Arguments to path.join must be strings Use --force to continue.

 Aborted due to warnings.

如果我更改@sindresorhus提议的文件对象:

files:{
          'css/main.css':['less/main.less']
        }

我明白了:

Running "recess:dev" (recess) task

GENERAL USE: $ recess [path] [options]

OPTIONS:
  --compile
  --compress
  --config
  --format
  --includePath
  --noIDs
  --noJSPrefix
  --noOverqualifying
  --noSummary
  --noUnderscores
  --noUniversalSelectors
  --prefixWhitespace
  --strictPropertyOrder
  --stripColors
  --watch
  --zeroUnits
  --inlineImages

EXAMPLE:

  $ recess ./bootstrap.css --noIDs false

GENERAL HELP: http://git.io/recess

我正在使用node@v0.10.10,npm@1.3.1,grunt@0.4.1

1 个答案:

答案 0 :(得分:1)

问题是dest需要是一个字符串(文件名或文件夹名),但在您的示例中,它是一个数组。我相信这应该有效:

    files:[{
            expand:true,
            cwd:'./',
            src:['<%= yeoman.less %>/**/*.less'],
            dest: '<%= yeoman.dist %>/css/', // lose the brackets
            ext:'.css'
        }]
  }