1.0.0 • Published 10 years ago

load-grunt-task-config v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

load-grunt-task-config

Loads configuration options for grunt tasks from a structured folder instead of defining them inline in gruntfile.js.

Usage

Create a folder as below:

grunt-project
  - package.js
  - gruntfile.js
  - config
    - cssmin.js
    - uglify.js

The config-folder is the one we work with here. By adding the line below to your gruntfile, you go from defining all configuration options inline to define them in separate files.

require('grunt-load-task-config')('./config/');

The name of the file (excl. the .js file ending) will be the name of the task the configuration options belong to.

Config file structure

The config file will be required():ed, so the file will have to follow standard node structure. That is, the data that is used must be confined in/under module.exports. Since it is configuration data, this must be an array.

Below is an example of a config file:

/* cssmin.js */
module.exports = {
  dev: {
    files: {
      'path/to/output.css': ['path/to/input_one.css', 'path/to/input_two.css']
    }
  },
  dist: {
    files: {
      'path/to/output2.css': ['path/to/input_three.css', 'path/to/input_four.css']
    }
  }
};

Version History

1.0.0

  • First release

License

Licensed under the MIT license.