0

So, I've recently started using Grunt, and it's working! Great.

As I use LESS, I decided I want development and production version of the compiled CSS - so I decided to add in the relevant targets. However, I'm now getting the error specified in the title.

I've looked at StackOverflow, and a lot of the solutions are regarding the [] around the 'files' option(is that the right word?), which I lack. I don't know where in the file I need to add them, and I've tried some places and it doesn't work.

Adding [] to the 'src' option I have doesn't work either.

Here's the first part of my Gruntfile - I don't believe the rest is needed.

module.exports = function(grunt) {

grunt.initConfig({

   pkg: grunt.file.readJSON('package.json'),
   less: { 
    production: { 
        options: { 
            path: ["css"], 
            cleancss: true 
    }, 

     src: {
        expand: true,
        cwd:    "css/",
        src:    ['*.less', '!_*.less'],
        dest:   "production/css/", 
        ext:    ".css"
}   
 }, 

 dev: {
   options: { 
    path: ["css"] 
}, 

src: { 
        expand: true,
        cwd:    "css/",
        src:    ['*.less', '!_*.less'],
        dest:   "css/", 
        ext:    ".css"
}
   }

         }, 

Thanks! I'm sorry in advance if this question is a repeat, but nothing else gives me any hints.


Thanks Josh for the guidance. Here's the modified function that produces what I'm looking for:

avg.ang <- function(x, ...){
  if (sum(is.na(x))==length(x)) {
      NA
  } else {
      round(mean.circular(circular(x, units="degrees", rotation="clock", 
                                   zero=pi/2, modulo="2pi"), na.rm=TRUE)) 
  }
}

The na.rm=TRUE is the key. The if/else statement is to deal with occurrences where all cells=NA (otherwise breaks with an error). If anyone has a more elegant way to deal with the if/else, I'm all ears.

4

1 に答える 1

1

ドキュメントと同じ方法でファイルを設定しようとしましたか?これは、ソースファイルを指定する方法とは少し異なります。

less: {
  development: {
    options: {
      paths: ["assets/css"]
    },
    files: {
      "path/to/result.css": "path/to/source.less"
    }
  },
  production: {
    options: {
      paths: ["assets/css"],
      cleancss: true,
      modifyVars: {
        imgPath: '"http://mycdn.com/path/to/images"',
        bgColor: 'red'
      }
    },
    files: {
      "path/to/result.css": "path/to/source.less"
    }
  }
}

詳細については、ドキュメントの使用例を参照してください: https://github.com/gruntjs/grunt-contrib-less#usage-examples

于 2014-04-29T16:25:13.157 に答える