Skip to content

Instantly share code, notes, and snippets.

@kazu69
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazu69/9014680 to your computer and use it in GitHub Desktop.
Save kazu69/9014680 to your computer and use it in GitHub Desktop.
load-grunt-config sample
default:
- 'jshint'
- 'notify'
- 'watch'
module.exports = function(grunt, options) {
var path = require('path');
require('load-grunt-config')(grunt, {
configPath: path.join(process.cwd(), 'grunt'), //path to task.js files, defaults to grunt dir
init: true, //auto grunt.initConfig
config: { //additional config vars
test: false
},
loadGruntTasks: { //can optionally pass options to load-grunt-tasks. If you set to false, it will disable auto loading tasks.
config: require('./package.json'),
scope: ['devDependencies', 'dependencies'],
pattern: ['grunt-*']
}
});
};
module.exports = (grunt) ->
all: [
'Gruntfile.js'
]
default:
options:
message: 'Default finished'
{
"name": "load-grunt-config-example",
"version": "0.0.0",
"description": "",
"main": "Gruntfile.js",
"dependencies": {
"grunt": "~0.4.2",
"grunt-notify": "~0.2.17",
"grunt-contrib-jshint": "~0.8.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-notify": "~0.2.17",
"load-grunt-config": "~0.7.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
grunt
Direct yaml files load via require() is deprecated! Use safeLoad() instead.
Running "jshint:all" (jshint) task
>> 2 files lint free.
Running "notify:default" (notify) task
Running "watch" task
Waiting...
.
├── Gruntfile.js
├── grunt
│   ├── aliases.yaml
│   ├── jshint.coffee
│   ├── notify.yaml
│   └── watch.js
├── node_modules
└── package.json
module.exports = {
all: {
files: [
'<%= jshint.all %>',
'grunt/*.yaml'
],
tasks: [
'default'
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment