Neverending Programming Mistakes
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

load-grunt-configuration

1.3.1 • Public • Published

load-grunt-configuration

Load multiple grunt configuration files

Installation

npm install load-grunt-configuration --save-dev

Example

Gruntfile.js

module.exports = function (grunt) {
    'use strict';
 
   require('load-grunt-configuration')(grunt, {
        files: [
            '_tasks',
            'styles',
            //...
        ],
        otherOptions: {
            foo: 'bar'            
        }
    });
};

grunt-config/_tasks.js

module.exports = function (grunt) {
    'use strict';
 
    grunt.registerTask('dev', [
        'styles',
    ]);
 
    grunt.registerTask('default', [
        'dev',
        'watch'
    ]);
 
};

grunt-config/styles.js

module.exports = function (grunt) {
    'use strict';
 
    // Task
    grunt.registerTask('styles', [
        'less:dev',
        'autoprefixer:dev'
    ]);
 
    // Config
    return {
        autoprefixer: {
            // ...
        },
        less: {
            // ...
        },
        watch: {
            // ...
        }
    };
};

Options

require('load-grunt-configuration')(grunt, options);

Package configuration

files

List of configuration files to load. Relative to gruntConfigFolder. Without '.js' extension.

Example:

[
    '_tasks',
    'styles'
]

gruntConfigFolder

Folder containing grunt configuration files to load.

Default : 'grunt-config'

packageJsonPath

Path to package.json file.

Default : 'package.json'

Project configuration

options object is merged into grunt.config.

Example

require('load-grunt-configuration')(grunt, {
    files : ['example'],
    path: {
        src: './src'
    }
}});

Read src value :

<%= path.src %>

Development

Tests

Run tests

grunt test

Keywords

none

install

npm i load-grunt-configuration

Downloadsweekly downloads

1

version

1.3.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability