Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Grunt
Search
lylijincheng
August 10, 2013
Technology
160
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Grunt
Introduction to grunt.js
lylijincheng
August 10, 2013
More Decks by lylijincheng
See All by lylijincheng
Nodejs getting-started
lylijincheng
1
180
Other Decks in Technology
See All in Technology
Harness Engineering on Rails
joelq
0
340
beyond jj: config & tools ecosystem
indirect
0
5.9k
アクセスキーこわい やめかたと漏らさない工夫
sassssan68
1
700
[Kiro Meetup #7] Kiro Crew Dive Deep
konippi
0
270
Cloudflare Workers 向けアプリを C# で構築する ~WASM Native AOT への道~
nenonaninu
1
1.4k
現場で役立つ技術負債の効果的な返済方法
masuda220
PRO
11
5.1k
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
540
事業課題から技術的負債に向き合う
sansantech
PRO
2
2.3k
Mastering Agentic Development: Harness Engineering for Effective Coding Agents
konippi
3
460
What the customer really needed
kawaguti
PRO
3
220
AIで社員の自主発信に広報目線を組み込む
_mossann_t
0
140
なぜ「決定性」が 決定的に重要なのか? Durable Execution 基盤の数理的理解 #serverlessjp / ServerlessDays Tokyo 2026
ytaka23
3
1.2k
Featured
See All Featured
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
580
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Visualization
eitanlees
153
17k
Code Review Best Practice
trishagee
74
20k
Tell your own story through comics
letsgokoyo
1
1.1k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
520
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
The agentic SEO stack - context over prompts
schlessera
0
940
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Transcript
Grunt 基于任务的命令行构建工具
开始 发音:[ɡrʌnt] 网站:http://gruntjs.com/ Github:https://github.com/gruntjs Wiki: https://github.com/gruntjs/grunt/wiki/Getting-started 使用:jQuery, bootstrap, yui, pure
…
任务 • JSHint 检测代码质量 • Concat 合并 • Copy 复制
• Minify 压缩 • Qunit 单元测试 • Source map 调试
准备 • Nodejs • NPM
安装 • the CLI • grunt-init • grunt-plugins • templates
安装全局命令 > npm install –g grunt-cli 作用:执行Grunt任务 将grunt命令添加到PATH路径,在任何目录都可运行。
安装 grunt-init > npm install –g grunt-init 作用:通过使用模板使项目创建实现自动化
安装插件 > npm install grunt-contrib-jshint --save-dev > npm install grunt-contrib-qunit
--save-dev > npm install grunt-contrib-concat --save-dev > npm install grunt-contrib-uglify --save-dev > npm install grunt-contrib-watch --save-dev
安装模板 模板会依赖当前环境或使用一些提问来建立整个项目的目录结构 可以使用现有的模板或自定义模板 grunt-init-gruntfile, grunt-init-gruntplugin. 使用模板创建Grunt项目 > grunt-init [template] 模板存放在
home 目录的 .grunt-init 文件夹下,可以使用git来安装 > git clone https://github.com/gruntjs/grunt-init-gruntfile.git ~/.grunt-init/gruntfile
准备一个新项目 在项目根目录下创建两个文件 • Gruntfile Gruntfile.js 或者 Gruntfile.coffee • Package.json
Gruntfile > grunt-init gruntfile • 配置或定义任务 • 加载Grunt插件
Gruntfile 结构 Gruntfile一般包括以下部分: • 外层包装函数 module.exports = function(grunt) {}; •
项目和任务配置 grunt.initConfig(/* config */) • 加载插件和任务 grunt.loadNpmTasks(/* plugins */) • 自定义任务 grunt.registerTask(/* default tasks */)
package.json > npm init • 存放项目信息,作为NPM模块发布 • 被Gruntfile依赖,读取项目有关配置和信息
使用Grunt • 切换至项目根目录 > cd • 安装依赖 > npm install
• 运行Grunt > grunt
</thanks>