最近在学习Bootstrap,了解一部分之后,发现Bootstrap使用了LESS,好嘛,开始学习LESS,LESS了解部分,发现自动编译工具Grunt,了解Grunt过程发现需要使用node.js的npm工具和语法。。。。。。得,打住吧,先安装node吧,之后再了解。由于本屌丝使用的是win7系统,所以以下教程均在win7下测试。
新版nodejs自带npm管理工具,可通过命令npm -version查看
如果你之前安装过node,可通过命令将npm更新到最新版:npm install npm@latest
module.exports = function(grunt) {
//配置
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
//concat插件的用途
concat : {
bar : {
src : ['src/menu.js','src/slide.js'],
dest : 'dest/main.js'
}
},
//uplify插件的用途
uglify : {
options : {
banner : '/* <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build : {
src : 'dest/main.js',
dest : 'dest/main.min.js'
}
}
});
//载入concat和uglify插件,分别对于合并和压缩
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
//注册任务
grunt.registerTask('default',['concat','uglify']);
};3.4 运行grunt命令原文:http://blog.csdn.net/xqg666666/article/details/44677229