Skip to content

Instantly share code, notes, and snippets.

@anilex
Forked from hail2u/Gruntfile.js
Created March 3, 2014 10:15
Show Gist options
  • Save anilex/9322052 to your computer and use it in GitHub Desktop.
Save anilex/9322052 to your computer and use it in GitHub Desktop.
{
"css": {
"src": [".grunt/tmp/*.css"]
},
"js": {
"src": [".grunt/tmp/*.js"]
}
}
{
"css": {
"expand": true,
"cwd": ".grunt/css/",
"src": ["*.css"],
"dest": ".grunt/tmp/"
},
"js": {
"expand": true,
"cwd": ".grunt/js/",
"src": ["*.js"],
"dest": ".grunt/tmp/"
}
}
{
"main": {
"expand": true,
"cwd": ".grunt/tmp/",
"src": ["*.css"],
"dest": "styles/",
"ext": ".min.css"
}
}
/
├─.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
'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'
]);
};
{
"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