Auto-generate modularized #grunt configuration files

I wrote a Grunt task which will take your big, fat grunt configuration object and automatically generate separate files to store the task configuration objects in: grunt-generate-configs

The task will parse your grunt configuration object and automatically create files for each task.

For example, if this is your grunt configuration inside Gruntfile.js:

grunt.initConfig({
    jshint   : {
        all     : [
            'Gruntfile.js', 'tasks/*.js', '<%=nodeunit.tests%>'
        ],
        options : {
            jshintrc : '.jshintrc',
        },
    },

    // Before generating any new files, remove any previously-created files.
    clean    : {
        config : ['config'],
    },

    // Unit tests.
    nodeunit : {
        tests : ['tests/*_test.js'],
    },
});

It will create the files jshint.json, clean.json and nodeunit.json inside a config directory, containing the configuration objects:

//file: config/jshint.json
{
  "all": [
    "Gruntfile.js",
    "tasks/*.js",
    "<%=nodeunit.tests%>"
  ],
  "options": {
    "jshintrc": ".jshintrc"
  }
}
//file: config/clean.json
{
  "config": [
    "config"
  ]
}
//file: config/nodeunit.json
{
  "tests": [
    "tests/*_test.js"
  ]
}

It supports generation of json, js modules, coffeescript and yaml.

For more info on installation, usage and examples visit grunt-generate-configs

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: