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
1
270
Introduction to gruntjs
A short talk given at Untangle the web on 24/09/2013 @ Skills Matter Exchange
Sam Mason
September 24, 2013
Tweet
Share
More Decks by Sam Mason
See All by Sam Mason
Working with Gulp, Neat & Bourbon
samjbmason
0
1.2k
Git & Github 101
samjbmason
5
180
First steps in the web - Wordpress as a CMS
samjbmason
2
78
Other Decks in Technology
See All in Technology
Amplify 🩷 Bedrock 〜生成AI入門〜
minorun365
PRO
8
720
Grafana x PagerDuty Better Together
jacopen
1
260
TechFeed Experts Night#27 〜 フロントエンドフレームワーク最前線 (Svelte)
baseballyama
2
590
競技としてのKaggle、役に立つKaggle
yu4u
6
2.3k
MapLibreとAmazon Location Service
dayjournal
1
190
Azureの基本的な権限管理の勉強会
yhana
1
2.1k
データベース02: データベースの概念
trycycle
0
180
チームでロジカルシンキングに改めて向き合っている話 〜学習環境と実践⽅法〜
sansantech
PRO
3
3.3k
AWSに詳しくない人でも始められるコスト最適化ガイド
yuhta28
2
400
コードファーストの考え方。 Amplify Gen2から学ぶAWS次世代のWeb開発体験
yoshiitaka
2
370
Android Target SDK 35 (Android 15) 対応の概要
akkie76
0
160
生産性向上チームの紹介
cybozuinsideout
PRO
1
920
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
226
17k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
660
120k
Building Flexible Design Systems
yeseniaperezcruz
320
37k
Building Better People: How to give real-time feedback that sticks.
wjessup
356
18k
Optimizing for Happiness
mojombo
370
69k
BBQ
matthewcrist
80
8.8k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
Scaling GitHub
holman
457
140k
Building Adaptive Systems
keathley
32
1.9k
Atom: Resistance is Futile
akmur
260
25k
The MySQL Ecosystem @ GitHub 2015
samlambert
244
12k
Code Review Best Practice
trishagee
56
15k
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