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
Introduction to gruntjs
Search
Sam Mason
September 24, 2013
Technology
280
1
Share
Introduction to gruntjs
A short talk given at Untangle the web on 24/09/2013 @ Skills Matter Exchange
Sam Mason
September 24, 2013
More Decks by Sam Mason
See All by Sam Mason
Working with Gulp, Neat & Bourbon
samjbmason
0
1.2k
Git & Github 101
samjbmason
5
210
First steps in the web - Wordpress as a CMS
samjbmason
2
110
Other Decks in Technology
See All in Technology
Forget technical debt
ufried
0
170
多角的な視点から見たAGI
terisuke
0
120
AIエージェントの支払い基盤 AgentCore Payments概要
kmiya84377
1
130
新卒エンジニア研修、ハンズオンの設計における課題と実践知/ #tachikawaany
nishiuma
2
130
Databricks Academic Series 〜 大規模言語モデル / エージェント編 〜 / academic-series-llm
databricksjapan
0
110
SLI/SLO、「完全に理解した」から「チョットデキル」へ
maruloop
1
130
古今東西SRE
okaru
1
130
OWASP APTSを眺めてみた
su3158
0
130
20260428_Product Management Summit_Loglass_JoeHirose
loglassjoe
4
7.3k
クラウドネイティブ DB はいかにして制約を 克服したか? 〜進化歴史から紐解く、スケーラブルアーキテクチャ設計指針〜
hacomono
PRO
3
270
Building a Study Buddy AI Agent from Scratch: From Passive Chatbots to Autonomous Systems
itchimonji
0
140
毎日の作業を Claude Code 経由にしたら、 ノウハウがコードになった
kossykinto
1
1.1k
Featured
See All Featured
Tell your own story through comics
letsgokoyo
1
910
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Music & Morning Musume
bryan
47
7.2k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
190
Prompt Engineering for Job Search
mfonobong
0
290
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.4k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
280
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.4k
Making Projects Easy
brettharned
120
6.6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Transcript
Intro to grunt
Hi I’m Sam Mason, a Developer at Benchmark @samjbmason http:/
/mason.io
Intro to grunt
What is grunt? Not this This
Runs all the tasks grunt.initConfig({ Buy Presents: { for girlfriend:
{ Price: >£100 }, for sister: { Price: <£10 } } });
grunt loves git The configuration is just a javascript file
so it can be added to git and shared
install node Go to http://nodejs.org/ Install the correct package. Fin!
install grunt-cli `npm install -g grunt-cli` In the terminal, type
To actually install grunt part 1 package.json In your project
folder, create Gruntfile.js &
To actually install grunt part 2 package.json { "name": "my-project-name",
"version": "1.0.0" } Then run in terminal npm install grunt --save-dev
grunt is installed in your project package.json { "name": "your-project",
"version": "1.0.0", "devDependencies": { "grunt": "~0.4.1" } }
install the grunt-contrib plugin Terminal npm install grunt-contrib --save-dev
grunt is installed in your project package.json { "name": "your-project",
"version": "1.0.0", "devDependencies": { "grunt": "~0.4.1", "grunt-contrib": "~0.7.0" } }
the gruntfile - wrapper function Gruntfile.js module.exports = function(grunt) {
// All your code goes in between here };
the gruntfile - load plugin Gruntfile.js module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib'); };
the gruntfile - configuration wrapper Gruntfile.js grunt.initConfig({ // All your
configuration goes in here });
the gruntfile - configuration wrapper Gruntfile.js grunt.initConfig({ sass: { dist:
{ options: { style: 'compressed' }, files: { 'css/main.css': 'css/main.scss' } } } });
the gruntfile - register tasks Gruntfile.js grunt.registerTask('default', ['sass']);
Setting up multiple tasks Gruntfile.js grunt.registerTask('default', ['sass']); grunt.registerTask('prod', ['sass','uglify']);
the gruntfile Gruntfile.js module.exports = function(grunt) { grunt.initConfig({ sass: {
dist: { options: { style: 'compressed' }, files: { 'css/main.css': 'css/main.scss' } } } }); grunt.loadNpmTasks('grunt-contrib'); grunt.registerTask('default', ['sass']); }
the gruntfile - configuration wrapper Gruntfile.js grunt.initConfig({ uglify: { my_target:
{ files: { 'js/main.min.js': ['js/main.js'] } } } });
Run the task Terminal - from your project folder grunt
Thanks for listening @samjbmason http:/ /mason.io