0.2.0 • Published 8 years ago

generator-web-starter-grunt v0.2.0

Weekly downloads
31
License
-
Repository
github
Last release
8 years ago

generator-web-starter-grunt

Allows other yeoman generators to add grunt tasks.

Usage

Grunt task

In the 'configuring' yeoman generator context:

if (typeof this.options.getPlugin === "function" && this.options.getPlugin('grunt')) {
  var editor = this.options.getPlugin('grunt').getGruntTask('postcss');
  editorinsertConfig('postcss.theme', '{ src : "build/css/*.css" }');
  editor.loadNpmTasks('grunt-contrib-postcss');
}

will output in the 'tasks/config/postcss.js'

  ...
  grunt.loadNpmTasks('grunt-postcss');
  grunt.config.merge({
    postcss: {
      'theme1': { 'src': 'build/css/*.css' },
  ...

All other functions available on the Gruntfile Editor can be used as well.

You also need to ensure that the appropriate package has been added to the project.

Adding NPM package

if (typeof this.options.addDevDependency === "function" && this.options.getPlugin('grunt')) {
  this.options.addDevDependency('grunt-postcss', '^0.8.0');
}

will output in 'package.json'

  ...
  "devDependencies":
    ...
    "grunt-postcss": "^0.8.0"
    ...

Note: this functionality is provided by main Yeoman generator