欢迎您访问我爱IT技术网,今天小编为你分享的javascript教程:【使用GruntJS链接与压缩多个JavaScript文件过程详解】,下面是详细的讲解!
使用GruntJS链接与压缩多个JavaScript文件过程详解
module.exports=function(grunt) {
grunt.initConfig({
//our JSHint options
jshint: {
all: ['main.js'] //files to lint
},
//our concat options
concat: {
options: {
separator: ';' //separates scripts
},
dist: {
src: ['js*.js'], //Grunt mini match for your scripts to concatenate
dest: 'js/fishchart_v0.0.1.js' //where to output the script
}
},
//our uglify options
uglify: {
js: {
files: {
'js/fishchart_v0.0.1.js': ['js/fishchart_v0.0.1.js'] //save over the newly created script
}
}
}
});
//load our tasks
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
// default tasks to run
// grunt.registerTask('default', ['jshint', 'concat', 'uglify']);
grunt.registerTask('development', ['jshint']);
grunt.registerTask('production', ['jshint', 'concat', 'uglify']);
}
关于使用GruntJS链接与压缩多个JavaScript文件过程详解的用户互动如下:
相关问题:javascript代码压缩用压缩工具还是自己写代码压缩?
答:一般用工具,可以使用ant做些自动化压缩设置, 推荐两个: 1.yui compressor http://www.oschina.net/p/yui+compressor 2.Google Closure Compiler >>详细
相关问题:如何在linux命令行下使用YUI来压缩CSS以及JavaScri...
答:base_url()."images/****.jpg"base_url()."js/*****.js"base_url()."css/****.css"应该就是这样调用的。调用控制器的话 应该用到的是site_url() 查看原帖>> >>详细
相关问题:
答: >>详细
- 【firefox】firefox浏览器不支持innerText的解决
- 【Extjs】Extjs学习过程中新手容易碰到的低级错误
- 【clearInterval】js clearInterval()方法的定义
- 【ComboBox】ComboBox 和 DateField 在IE下消失的
- 【dom】javascript dom追加内容实现示例-追加内容
- 【has】基于jquery的has()方法以及与find()方法以
- 【extjs】Extjs入门之动态加载树代码-动态加载树
- 【checkbox】让checkbox不选中即将选中的checkbox
- 【Array】js中更短的 Array 类型转换-类型转换
- 【append】append和appendTo的区别以及appendChil
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
