0.0.4 • Published 10 years ago

grunt-autoload-config v0.0.4

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

grunt-autoload-config

Auto load grunt configurations

About

The motivation for this module is to auto load grunt-config, and allows you to break up your task config

  • the best way to decompartmentalize your grunt task configuration.
  • great for mid to large applications

Install

npm install grunt-autoload-config --save-dev

Options

  require('grunt-autoload-config')(grunt, {
    path: './task-config/', //path to custom task config
    ext: '.js', //file extension
    initConfig: { //existing grunt configuration
      pkg: grunt.file.readJSON('package.json')
    }
  });

Examples

Here is an example on how to use it:

Gruntfile

Gruntfile.coffee

  "use strict"
  module.exports = (grunt) ->
    require('time-grunt')(grunt)
    require('load-grunt-tasks')(grunt)
    require('grunt-autoload-config') grunt,
      path: './grunt'

Gruntfile.js

  "use strict";
  module.exports = function(grunt) {
    require('time-grunt')(grunt);
    require('load-grunt-tasks')(grunt);
    return require('grunt-autoload-config')(grunt, {
      path: './grunt'
    });
  };

Register Task

aliases.yaml

  default:
    - 'coffee:script'
    - 'images'

  images
    - 'svgmin'

Configuration

svgmin.js

  module.exports = {
    tests: ["tmp"]
  }

coffee-script.js

  module.exports = script: {
    options: {
      join: true
    },
    files: {
      'path/to/result.js': 'path/to/source.coffee', // 1:1 compile, identical output to join = false
      'path/to/another.js': ['path/to/sources/*.coffee', 'path/to/more/*.coffee'] // concat then compile into single file
    }
  }

Todo

Notes

Inspired by load-grunt-tasks

License

MIT © Carlos Marte