Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Grunt.js
Search
Matias Singers
January 29, 2014
Programming
180
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Grunt.js
Matias Singers
January 29, 2014
Other Decks in Programming
See All in Programming
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
7.2k
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
1k
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
200
関数型プログラミングのメリットって何だろう?
wanko_it
0
120
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
7
1.1k
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
140
20260623_Loop Engineeringで自分の分身の問い合わせBotを作る
ryugen04
0
110
OS アップデート対応の取り組み方がもっと共有されてほしい
andpad
0
110
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
210
【やさしく解説 設計編 #0】DDDのコード、読めるのに分からない人へ
panda728
PRO
1
190
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
820
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
12
4.6k
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
77
5.4k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
GraphQLとの向き合い方2022年版
quramy
50
15k
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
380
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
55k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
210
30 Presentation Tips
portentint
PRO
1
340
Faster Mobile Websites
deanohume
310
32k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
150
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
450
Transcript
None
Grunt
$ npm install -g grunt-cli Installation
Setup + Gruntfile.js package.json
$ npm init $ npm install grunt --save-dev $ npm
install grunt-contrib-connect --save-dev $ npm install grunt-contrib-watch --save-dev $ npm install grunt-contrib-sass --save-dev $ npm install load-grunt-tasks --save-dev Install Grunt plugins
1 { 2 "name": "my-project", 3 "version": "0.1.0", 4 "devDependencies":
{ 5 "grunt": "~0.4.2", 6 "grunt-contrib-connect": "~0.6.0", 7 "grunt-contrib-watch": "~0.5.3", 8 "grunt-contrib-sass": "~0.7.0", 9 "load-grunt-tasks": "~0.3.0" 10 } 11 } package.json https://npmjs.org/doc/json.html
• Loading Grunt plugins and tasks • "wrapper" function •
Project and task configuration • Custom tasks Gruntfile.js http://gruntjs.com/getting-started
1 module.exports = function(grunt) { 2 // instead of having
multiple grunt.loadNpmTasks(''); 3 require('load-grunt-tasks')(grunt); 4 5 // Do grunt-related things in here 6 }; Gruntfile.js - wrapper http://gruntjs.com/getting-started
1 module.exports = function(grunt) { 2 require('load-grunt-tasks')(grunt); 3 4 grunt.initConfig({
5 connect: { 6 options: { 7 port: 9001, 8 open: true, 9 hostname: 'localhost' 10 }, 11 server: { 12 // specific configs for the server task 13 } 14 }, 15 }); 16 }; Gruntfile.js - task configuration http://gruntjs.com/getting-started
1 // Default task(s). 2 grunt.registerTask('default', ['connect:server']); Gruntfile.js - custom
tasks http://gruntjs.com/getting-started
1 // Default task(s). 2 grunt.registerTask('default', ['connect:server']); Gruntfile.js - custom
tasks 1 // A very basic default task. 2 grunt.registerTask('default', 'Logger', function() { 3 grunt.log.write('Logging...').ok(); 4 }); http://gruntjs.com/getting-started
Gruntfile.js - custom tasks 1 grunt.registerTask('server', [ 2 'clean:server', 3
'sass:server', 4 'connect:server', 5 'watch' 6 ]); http://gruntjs.com/getting-started
http://gruntjs.com/plugins
http://gruntjs.com/plugins
None
Concatenating 1 concat: { 2 'js/main.js': [ 3 'js/controllers/events.js', 4
'js/controllers/login.js', 5 'js/controllers/menu.js' 6 ] 7 } module: grunt-contrib-concat
Concatenating module: grunt-contrib-concat grunt-usemin + 1 <!-- build:js js/main.js -->
2 <script src="js/controllers/events.js"></script> 3 <script src="js/controllers/login.js"></script> 4 <script src="js/controllers/menu.js"></script> 5 <!-- endbuild -->
Watching files 1 watch: { 2 sass: { 3 files:
['styles/**/*.{scss,sass}'], 4 tasks: ['sass:server'] 5 }, 6 livereload: { 7 files: [ 8 'views/**/*.html', 9 'scripts/**/*.js', 10 'styles/**/*.css', 11 'img/**/*.{png,jpg,jpeg,gif,webp,svg}' 12 ], 13 options: { 14 livereload: true 15 } 16 } 17 } module: grunt-contrib-watch
Watching files module: grunt-contrib-watch - Waiting... OK >> File "public/styles/main.sass"
changed. ! Running "sass:app" (sass) task ! Done, without errors. ... Reload public/styles/main.css ... Completed in 0.178s at Tue Jan 28 2014 12:22:51 GMT+0800 (MYT)
None
enjoy your automated workflow!
Advantages
@matiassingers github.com/matiassingers Thank you! Any questions?