Grunt实例
module.exports = function(grunt) {
// 项目配置
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: { //清除目标文件下文件
huzhao: {
src: "dest"
}
},
uglify: {
huzhao: {
files: [{
expand: true,
cwd: 'src', //js目录下
src: '*.js', //所有js文件
dest: 'dest' //输出到此目录下
}]
}
},
sass: {
huzhao: {
files: [{
expand: true,
cwd: 'src',
src: ['*.scss'],
dest: 'dest',
ext: '.css'
}]
}
},
cssmin: { //压缩css
huzhao: {
"files": {
'dest/main.css': ['dest/*.css']
}
}
},
htmlmin: { //压缩html
huzhao: {
options: { // Target options
removeComments: true,
collapseWhitespace: true
},
files: [{
expand: true, // Enable dynamic expansion.
cwd: 'src/', // Src matches are relative to this path.
src: ['*.html'], // Actual pattern(s) to match.
dest: 'dest/', // Destination path prefix.
ext: '.html', // Dest filepaths will have this extension.
extDot: 'first' // Extensions in filenames begin after the first dot
}]
}
}
});
// 加载提供"uglify"任务的插件
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
// 默认任务
grunt.registerTask('huzhao', ['clean:huzhao', 'uglify:huzhao', 'sass:huzhao', 'cssmin:huzhao', 'htmlmin:huzhao']);
}
Grunt实例的更多相关文章
- grunt 实例构建(四)
相关插件的引用: grunt-usemin 对页面的操作 grunt-contrib-cssmin 压缩css load-grunt-tasks 瘦身gruntfile grunt-rev给md5 ...
- 初学seaJs模块化开发,利用grunt打包,减少http请求
原文地址:初学seaJs模块化开发,利用grunt打包,减少http请求 未压缩合并的演示地址:demo2 学习seaJs的模块化开发,适合对seajs基础有所了解的同学看,目录结构 js — —di ...
- Grunt参考
Grunt参考: http://www.cnblogs.com/yexiaochai/p/3603389.html http://blog.csdn.net/wangfupeng1988/articl ...
- grunt小教程
本人的博客写了grunt的小教程,从零开始,一步一步的通过例子讲解,希望喜欢的同学给我的github上加颗星,谢谢! github地址: https://github.com/manlili/grun ...
- 最近学习工作流 推荐一个activiti 的教程文档
全文地址:http://www.mossle.com/docs/activiti/ Activiti 5.15 用户手册 Table of Contents 1. 简介 协议 下载 源码 必要的软件 ...
- 用grunt进行ES6转换,再用uglify压缩所有js实例
1.首先安装node.js 去官网下载exe执行文件安装即可,安装完成后自带有npm管理. 2.安装grunt CLI 在项目根文件夹下执行如下代码: npm install -g grunt-cli ...
- grunt入门讲解3:实例讲解使用 Gruntfile 配置任务
这个Gruntfile 实例使用到了5个 Grunt 插件: grunt-contrib-uglify grunt-contrib-qunitgrunt-contrib-concatgrun ...
- grunt配置任务
这个指南解释了如何使用 Gruntfile 来为你的项目配置task.如果你还不知道 Gruntfile 是什么,请先阅读 快速入门 指南并看看这个Gruntfile 实例. Grunt配置 Grun ...
- Grunt(页面静态引入的文件地址的改变探究)-V2.0
相关插件的引用: grunt-usemin 对页面的操作 grunt-contrib-cssmin 压缩css load-grunt-tasks 瘦身gruntfile grunt-rev给md5 ...
随机推荐
- 针对myeclipse6.5无法自动生成toString方法
public void getToStringSTR(){ Field[] fs = this.getClass().getDeclaredFields(); for (int i = 0; i &l ...
- 爬虫防封IP
当抓取数据逐渐增大时,服务器的负荷会加大,会直接封掉来访IP: 采取措施: 1.创建请求头部信息: headers = {'User-Agent': 'Mozilla/5.0 (Windows NT ...
- HTML中title前面小图标和网站收藏现实的图标
网站上的logo实际上是一个“favicon.ico”图片.实现步骤:第一步:制作favicon.ico,大小为16*16毫米:第二步:将“favicon.ico”放到项目的根路径下. 第三步:在所有 ...
- php post get 繁体、日文、韩文时 自动添加 反斜杠 问题
做些二次开发项目,数据库.文件编码没法大规模的修改,比如二次开发一个日文系统,编码是JA16SJIS,$_POST或$_GET的信息中如果“申請”,得到的信息就会变成“申\請”,多出一个反斜杠! 先贴 ...
- python之类与对象(2)
3. 类函数的进阶 3.1 类函数调用类属性 关于类函数调用类属性,我们尝试修改前一节的内容,以我们在之前学习的内容,调用属性直接用%+属性就可以了,那我们来试一下: 看到了程序有报错,这其实是因为在 ...
- 2019 CCPC-Wannafly Winter Camp Day4(Div2, onsite)
slove 6/11 A.夺宝奇兵 Code:zz Thinking:zz 贪心即可.这条路线里,点n1和点n2肯定是相连的,接下来,点(n-1)1和点(n-1)2分别是和n1和点n2相连的,一共有两 ...
- shell (2) 时间处理
获取当前的时间,并输出 #!/bin/bash if [ $# -ne 1 ];then echo "input an dmesg time" exit 1 fi unix_tim ...
- centos7安装串口终端kermit
1. 将usb转串口连接到PC上.通过dmesg命令可以查看USB转串口是否被PC识别.显示 ……attachec to ttyUSB0即被识别. 2. 安装kermit. [seif@cen ...
- RabbitMQ的TopicExchange通配符问题
TopicExchange交换机支持使用通配符*.# *号只能向后多匹配一层路径. #号可以向后匹配多层路径.
- TCP/CP调试
首先要先给自己的电脑分配一个固定的内网IP,不可以自动获取,然后将这个固定的IP设置为DMZ主机就可以将你的电脑暴露给外网,就能实现你想要的功能!! {1}设置成固定IP的方法是在路由的DHCP服务器 ...