Neovictorian Paisley Menswear
Miss any of our Open RFC calls?Watch the recordings here! »

et-grunt

0.1.4 • Public • Published

et-grunt

Build Status

Grunt task manager including jit-grunt

et-grunt register tasks with ease. It is a task manager which makes your life easier. It also loads tasks when you really need them, using jit-grunt.

Before

grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
...
 
grunt.registerTask('manage:js', [
    'clean:js',
    'concat:js',
]);
 
grunt.registerTask('manage:assets', [
    'concat:assets',
    'copy:assets',
]);
 
grunt.registerTask('serve:dev', [
    'clean',
    'manage:js',
    'connect'
]);

After

require('et-grunt')(grunt, {
    manage: {
        js: [
            'clean:js',
            'concat:js'
        ],
        assets: [
            'concat:assets',
            'copy:assets'
        ]
    },
    serve: {
        dev: [
            'clean',
            'manage:js',
            'connect'
        ]
    }
});

Install

npm install et-grunt --save-dev

or

yarn add et-grunt

Usage

require('et-grunt')(grunt, tasksAsObject);
// optional
var jitMappings = {
    yourStaticJitMappings
};
 
require('et-grunt')(grunt, {
    // task
    manage: {
        // default task, means just 'manage'
        default: [
            'manage:sass',
            'manage:js',
            'manage:app',
        ],
        // sub task -> 'manage:js'
        js: [
            'concat:js',
            'concat:vendor',
            'clean:bower'
        ],
    },
    minify: {
        js: [
            'manage:js',
            'uglify:js'
        ]
    }
}, jitMappings);

Now available in your shell:

grunt manage
grunt manage:js
grunt minify:js

Gruntdefault task

The very first object value should have the value default

default: ['taskName']

Default (taskName)

In every object you can write default as key and et-grunt knows automatically that the following array should be called as default. Example:

taskName: {
    default: ['concat']
}

Available as:

grunt taskName

Subtasks (taskName:subtask)

If you want to have subtasks like manage:js then you have to nest an object into the other object. Example:

taskName: {
    subtask: ['concat:js']
}

Available as:

grunt taskName:subtask

Use jit-grunt

Note: How jit-grunt works can you read here

Use static mappings

The argument after the tasks are reserved for jit static mappings.

var jitMappings = {
    // all settings
};
 
require('et-grunt')(grunt, tasksAsObject, jitMappings);

Use options

require('et-grunt')(grunt, tasksAsObject)(options);

Example pluginsRoot:

require('jit-grunt')(grunt, tasksAsObject)({
   pluginsRoot: 'other/dir'
});

Pre-Registered tasks

tasks

Default

see which tasks are available

Run grunt tasks and you will see all available tasks

Extended

  • see which options every task will need

Run grunt tasks:ext or grunt tasks:extended

Release History

  • 2016-12-02 v0.1.2 Fixed unlimited nesting
  • 2015-09-30 v0.1.1 Small fixes
  • 2015-09-30 v0.1.0 Added jit-grunt options support + pre-registered task.
  • 2015-09-25 v0.0.2 Added jit-grunt static maps support.
  • 2015-09-25 v0.0.1 First release.

LICENSE

MIT © Jan Peer Stöcklmair

Install

npm i et-grunt

DownloadsWeekly Downloads

2

Version

0.1.4

License

MIT

Last publish

Collaborators

  • avatar