Created
February 18, 2014 13:01
-
-
Save hail2u/9070532 to your computer and use it in GitHub Desktop.
Load Grunt plugin config from `.grunt/config/*.json` and load Grunt tasks from `package.json`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"css": { | |
"src": [".grunt/tmp/*.css"] | |
}, | |
"js": { | |
"src": [".grunt/tmp/*.js"] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"css": { | |
"expand": true, | |
"cwd": ".grunt/css/", | |
"src": ["*.css"], | |
"dest": ".grunt/tmp/" | |
}, | |
"js": { | |
"expand": true, | |
"cwd": ".grunt/js/", | |
"src": ["*.js"], | |
"dest": ".grunt/tmp/" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"main": { | |
"expand": true, | |
"cwd": ".grunt/tmp/", | |
"src": ["*.css"], | |
"dest": "styles/", | |
"ext": ".min.css" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ | |
├─.grunt/ | |
│ ├─css/ | |
│ │ └─style.css | |
│ ├─js/ | |
│ │ └─script.js | |
│ ├─tmp/ | |
│ └─config/ | |
│ ├─clean.json | |
│ ├─copy.json | |
│ ├─cssmin.json | |
│ └─uglify.json | |
├─scripts/ | |
│ └─scripts.min.js | |
├─style/ | |
│ └─style.mincss | |
└─Gruntfile.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strcit'; | |
var path = require('path'); | |
module.exports = function (grunt) { | |
var config = { | |
pkg: grunt.file.readJSON('package.json') | |
}; | |
grunt.file.expand('.grunt/config/*.json').forEach(function (file) { | |
config[path.basename(file, '.json')] = grunt.file.readJSON(file); | |
}); | |
grunt.initConfig(config); | |
for (var devDependency in grunt.config.data.pkg.devDependencies) { | |
if (devDependency.match(/^grunt-/)) { | |
grunt.loadNpmTasks(devDependency); | |
} | |
} | |
grunt.util.linefeed = '\n'; | |
grunt.registerTask('rebuild:css', [ | |
'clean:css', | |
'copy:css', | |
'cssmin' | |
]); | |
grunt.registerTask('rebuild:js', [ | |
'clean:js', | |
'copy:js', | |
'uglify' | |
]); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"options": { | |
"beautify": { | |
"ascii_only": true | |
}, | |
"preserveComments": "some" | |
}, | |
"main": { | |
"expand": true, | |
"cwd": ".grunt/tmp/", | |
"src": ["*.js"], | |
"dest": "scripts/", | |
"ext": ".min.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment