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
Search
sporto
November 26, 2013
Programming
200
1
Share
Grunt
sporto
November 26, 2013
More Decks by sporto
See All by sporto
React inside Elm
sporto
2
190
Elm
sporto
1
270
Redux: Flux Reduced
sporto
1
370
Practically Immutable
sporto
0
200
Webpack and React
sporto
4
400
Rails with Webpack
sporto
1
230
Lesson learnt building Single Page Application
sporto
0
140
Safe Testing in Ruby
sporto
1
140
Go - A great language for building web applications
sporto
1
350
Other Decks in Programming
See All in Programming
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
190
ドメインイベントでビジネスロジックを解きほぐす #phpcon_odawara
kajitack
3
780
AWS re:Invent 2025の少し振り返り + DevOps AgentとBacklogを連携させてみた
satoshi256kbyte
3
160
10年分の技術的負債、完済へ ― Claude Code主導のAI駆動開発でスポーツブルを丸ごとリプレイスした話
takuya_houshima
0
2.6k
JOAI2026 1st solution - heron0519 -
heron0519
0
140
ファインチューニングせずメインコンペを解く方法
pokutuna
0
310
Liberating Ruby's Parser from Lexer Hacks
ydah
2
1.2k
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
340
의존성 주입과 모듈화
fornewid
0
140
アクセシビリティ試験の"その後"を仕組み化する
yuuumiravy
0
150
Google Nest CamとApple Vision frameworkと猫🐈🐈⬛ / onishi50
yutailang0119
0
110
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
220
Featured
See All Featured
Marketing to machines
jonoalderson
1
5.2k
Building an army of robots
kneath
306
46k
It's Worth the Effort
3n
188
29k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
270
Joys of Absence: A Defence of Solitary Play
codingconduct
1
350
Raft: Consensus for Rubyists
vanstee
141
7.4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
How to Talk to Developers About Accessibility
jct
2
180
Unsuck your backbone
ammeep
672
58k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.6k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
160
How to make the Groovebox
asonas
2
2.1k
Transcript
Grunt @sebasporto
WHAT? Task runner (like make, rake)
WHY? Cross platform Lots of plug-ins Nice logging Is JS
Is Node
WHY NOT? Verbose Could end as an unmaintainable complex tangle
mess of configuration
Main uses Build system Live reload Daemons Automated tasks Whatever
Common plug-ins Lint Minify Concat Test (Mocha, Jasmine) Optimise images
Installing grunt Install grunt cli as global Install grunt as
local Uses package.json to keep track of dependencies (devDependecies)
Gruntfile module.exports = function(grunt) { ! grunt.initConfig({ uglify: { build:
{ src: 'src/<%= pkg.name %>.js', dest: 'build/<%= pkg.name %>.min.js' } } }); ! grunt.loadNpmTasks('grunt-contrib-uglify'); ! grunt.registerTask('default', ['uglify']); }; tasks config loading and registering tasks
A basic task grunt.registerTask('foo', 'A task', function(arg1, arg2) { …
}); $ grunt foo arg1 arg2
Just Node var foo = require(‘foo’); ! grunt.registerTask('foo', 'A task',
function(arg1, arg2) { // You can do whatever you can with Node ! foo.doSomething(); });
A multitask grunt.registerMultiTask('foo', 'A task', function() { … }); grunt.initConfig({
foo: { dev: {…}, prod: {…} } });
Multitasks $ grunt foo grunt.initConfig({ foo: { dev: {…}, prod:
{…} } }); runs dev and prod
Multitasks $ grunt foo:dev grunt.initConfig({ foo: { dev: {…}, prod:
{…} } }); runs dev only
Chaining tasks grunt.registerTask(‘all', [‘jshint’, ‘mocha’, ‘concat’]); $ grunt all
Chaining tasks grunt.registerTask('all', 'A task', function() { grunt.task.run(‘jshint’, ‘concat’); grunt.task.run(‘ngmin’);
}); $ grunt all
Async tasks grunt.registerTask('all', 'A task', function() { var done =
this.async(); ! doSomethingAsync(done); }); $ grunt all
Events grunt.event.on(‘foo:started’, handler); ! grunt.event.emit(‘foo:stated’, args…);
Installing a plug-in $ npm install grunt-goserver --save-dev grunt.loadNpmTasks(‘grunt-goserver'); !
grunt.initConfig({ goserver: { default: { srcPath: '/full/path/to/src/folder', … }, }, }) In Gruntfile.js
Creating a plug-in Install grunt-init module Clone template Run generator
Code npm publish
Plug-in best practices Create an NPM module first Wrap that
module in a Grunt plug-in
Thanks @sebasporto