Created
August 21, 2013 01:42
-
-
Save xiaojue/6289497 to your computer and use it in GitHub Desktop.
grunt file
This file contains hidden or 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
var lithe = require('lithe'); | |
var path = require('path'); | |
var tool = lithe.tool; | |
var hfs = lithe.hfs; | |
var litheOptions = tool.options; | |
var dir = __dirname; | |
var basepath = path.resolve(dir, 'src'); | |
var distpath = path.resolve(dir, 'dist'); | |
var config = require(basepath + '/config.js'); | |
var banner = '/* <%=pkg.name%> | <%=pkg.description%> | vserion <%=pkg.version%>*/\r\n'; | |
litheOptions.basepath = basepath; | |
litheOptions.alias = config.alias; | |
var appdeps = function() { | |
var conf = path.resolve(dir, basepath + '/conf/app.js'); | |
var requires = tool.findJsAllrequires(conf); | |
requires.push(conf); | |
return requires; | |
} (); | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
concat: { | |
options: { | |
banner: banner | |
}, | |
dist: { | |
src: appdeps, | |
dest: 'assest/conf/app.js' | |
} | |
}, | |
uglify: { | |
options: { | |
mangle: { | |
except: ['require'] | |
}, | |
banner: banner | |
}, | |
app: { | |
files: { | |
"assest/config.js": ['src/config.js'], | |
"assest/conf/app.js": ['assest/config.js', 'assest/conf/app.js'], | |
"assest/lithe-min.js": ['src/lithe.js'] | |
} | |
} | |
}, | |
css_combo: { | |
options: { | |
compress: true | |
}, | |
css: { | |
files: { | |
'assest/style/css/cblog.min.css': ['style/css/cblog.css'] | |
} | |
} | |
}, | |
copy: { | |
images: { | |
files: [{ | |
expand: true, | |
cwd: 'style/images/', | |
src: '**', | |
dest: 'assest/style/images/' | |
}] | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-css-combo'); | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.registerTask('default', ['concat:dist', 'uglify:app', 'css_combo:css', 'copy:images']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment