Submit Search
Upload
GRUNT - The JavaScript Task Runner
•
Download as PPTX, PDF
•
2 likes
•
820 views
Larry Nung
Follow
GRUNT - The JavaScript Task Runner
Read less
Read more
Technology
Report
Share
Report
Share
1 of 33
Download now
Recommended
Automated css
Automated css
Hayashi Yuichi
GruntJs Installation and popular plugins. MoscowJS
GruntJs Installation and popular plugins. MoscowJS
Dmitri Kunin
Task Automatisierung mit Grunt.js
Task Automatisierung mit Grunt.js
3rfan
Gulp.js - alternatywa do Grunta
Gulp.js - alternatywa do Grunta
The Software House
Affär - inte teknik
Affär - inte teknik
Per Åström
Docker for localhost development (on Serbian)
Docker for localhost development (on Serbian)
Milan Urukalo
PostCSS
PostCSS
Joan Leon
JavaScript frameworks, libraries and tools
JavaScript frameworks, libraries and tools
Dima Denisenko
Recommended
Automated css
Automated css
Hayashi Yuichi
GruntJs Installation and popular plugins. MoscowJS
GruntJs Installation and popular plugins. MoscowJS
Dmitri Kunin
Task Automatisierung mit Grunt.js
Task Automatisierung mit Grunt.js
3rfan
Gulp.js - alternatywa do Grunta
Gulp.js - alternatywa do Grunta
The Software House
Affär - inte teknik
Affär - inte teknik
Per Åström
Docker for localhost development (on Serbian)
Docker for localhost development (on Serbian)
Milan Urukalo
PostCSS
PostCSS
Joan Leon
JavaScript frameworks, libraries and tools
JavaScript frameworks, libraries and tools
Dima Denisenko
Сборка JavaScript-проектов с помощью Grunt
Сборка JavaScript-проектов с помощью Grunt
FDConf
C/C++とWebAssemblyを利用したライブラリ開発
C/C++とWebAssemblyを利用したライブラリ開発
祐司 伊藤
詳説WebAssembly
詳説WebAssembly
祐司 伊藤
Rubyslava2102
Rubyslava2102
Marius Sajgalik
Progressive Mobile Web Apps
Progressive Mobile Web Apps
dynamis
Discover ServiceWorker
Discover ServiceWorker
Sandro Paganotti
Modern Mobile Web Apps
Modern Mobile Web Apps
dynamis
Ninja dojo
Ninja dojo
Iuri Andreazza
[@NaukriEngineering] Git Basic Commands and Hacks
[@NaukriEngineering] Git Basic Commands and Hacks
Naukri.com
Java script.trend(spec)
Java script.trend(spec)
dynamis
Git Submodules
Git Submodules
Maciej Lasyk
Wordpress 24/7
Wordpress 24/7
Антон Еремин
Where to start refactoring?
Where to start refactoring?
thiagoalessio
EcmaScript Harmony
EcmaScript Harmony
Yordan Ivanov
Automation build
Automation build
Ivanildo Silva de LIMA
Config postgres in linux
Config postgres in linux
james jonatan rivera vega
PaaS向けCMS Lokka
PaaS向けCMS Lokka
Masaki Komagata
git svn workflow
git svn workflow
yinhm .
CiklumJavaSat _5112011:Igor Khotin-Gradle
CiklumJavaSat _5112011:Igor Khotin-Gradle
Ciklum Ukraine
Setting local domain di virtual host
Setting local domain di virtual host
FgroupIndonesia
Ansible - simple it automation
Ansible - simple it automation
Larry Nung
sonarwhal - a linting tool for the web
sonarwhal - a linting tool for the web
Larry Nung
More Related Content
What's hot
Сборка JavaScript-проектов с помощью Grunt
Сборка JavaScript-проектов с помощью Grunt
FDConf
C/C++とWebAssemblyを利用したライブラリ開発
C/C++とWebAssemblyを利用したライブラリ開発
祐司 伊藤
詳説WebAssembly
詳説WebAssembly
祐司 伊藤
Rubyslava2102
Rubyslava2102
Marius Sajgalik
Progressive Mobile Web Apps
Progressive Mobile Web Apps
dynamis
Discover ServiceWorker
Discover ServiceWorker
Sandro Paganotti
Modern Mobile Web Apps
Modern Mobile Web Apps
dynamis
Ninja dojo
Ninja dojo
Iuri Andreazza
[@NaukriEngineering] Git Basic Commands and Hacks
[@NaukriEngineering] Git Basic Commands and Hacks
Naukri.com
Java script.trend(spec)
Java script.trend(spec)
dynamis
Git Submodules
Git Submodules
Maciej Lasyk
Wordpress 24/7
Wordpress 24/7
Антон Еремин
Where to start refactoring?
Where to start refactoring?
thiagoalessio
EcmaScript Harmony
EcmaScript Harmony
Yordan Ivanov
Automation build
Automation build
Ivanildo Silva de LIMA
Config postgres in linux
Config postgres in linux
james jonatan rivera vega
PaaS向けCMS Lokka
PaaS向けCMS Lokka
Masaki Komagata
git svn workflow
git svn workflow
yinhm .
CiklumJavaSat _5112011:Igor Khotin-Gradle
CiklumJavaSat _5112011:Igor Khotin-Gradle
Ciklum Ukraine
Setting local domain di virtual host
Setting local domain di virtual host
FgroupIndonesia
What's hot
(20)
Сборка JavaScript-проектов с помощью Grunt
Сборка JavaScript-проектов с помощью Grunt
C/C++とWebAssemblyを利用したライブラリ開発
C/C++とWebAssemblyを利用したライブラリ開発
詳説WebAssembly
詳説WebAssembly
Rubyslava2102
Rubyslava2102
Progressive Mobile Web Apps
Progressive Mobile Web Apps
Discover ServiceWorker
Discover ServiceWorker
Modern Mobile Web Apps
Modern Mobile Web Apps
Ninja dojo
Ninja dojo
[@NaukriEngineering] Git Basic Commands and Hacks
[@NaukriEngineering] Git Basic Commands and Hacks
Java script.trend(spec)
Java script.trend(spec)
Git Submodules
Git Submodules
Wordpress 24/7
Wordpress 24/7
Where to start refactoring?
Where to start refactoring?
EcmaScript Harmony
EcmaScript Harmony
Automation build
Automation build
Config postgres in linux
Config postgres in linux
PaaS向けCMS Lokka
PaaS向けCMS Lokka
git svn workflow
git svn workflow
CiklumJavaSat _5112011:Igor Khotin-Gradle
CiklumJavaSat _5112011:Igor Khotin-Gradle
Setting local domain di virtual host
Setting local domain di virtual host
More from Larry Nung
Ansible - simple it automation
Ansible - simple it automation
Larry Nung
sonarwhal - a linting tool for the web
sonarwhal - a linting tool for the web
Larry Nung
LiteDB - A .NET NoSQL Document Store in a single data file
LiteDB - A .NET NoSQL Document Store in a single data file
Larry Nung
PL/SQL & SQL CODING GUIDELINES – Part 8
PL/SQL & SQL CODING GUIDELINES – Part 8
Larry Nung
MessagePack - An efficient binary serialization format
MessagePack - An efficient binary serialization format
Larry Nung
PL/SQL & SQL CODING GUIDELINES – Part 7
PL/SQL & SQL CODING GUIDELINES – Part 7
Larry Nung
BenchmarkDotNet - Powerful .NET library for benchmarking
BenchmarkDotNet - Powerful .NET library for benchmarking
Larry Nung
PLSQL Coding Guidelines - Part 6
PLSQL Coding Guidelines - Part 6
Larry Nung
SonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code Quality
Larry Nung
Visual studio 2017
Visual studio 2017
Larry Nung
Web deploy command line
Web deploy command line
Larry Nung
Web deploy
Web deploy
Larry Nung
SikuliX
SikuliX
Larry Nung
Topshelf - An easy service hosting framework for building Windows services us...
Topshelf - An easy service hosting framework for building Windows services us...
Larry Nung
Common.logging
Common.logging
Larry Nung
protobuf-net - Protocol Buffers library for idiomatic .NET
protobuf-net - Protocol Buffers library for idiomatic .NET
Larry Nung
PL/SQL & SQL CODING GUIDELINES – Part 5
PL/SQL & SQL CODING GUIDELINES – Part 5
Larry Nung
Regular expression
Regular expression
Larry Nung
PL/SQL & SQL CODING GUIDELINES – Part 4
PL/SQL & SQL CODING GUIDELINES – Part 4
Larry Nung
Fx.configuration
Fx.configuration
Larry Nung
More from Larry Nung
(20)
Ansible - simple it automation
Ansible - simple it automation
sonarwhal - a linting tool for the web
sonarwhal - a linting tool for the web
LiteDB - A .NET NoSQL Document Store in a single data file
LiteDB - A .NET NoSQL Document Store in a single data file
PL/SQL & SQL CODING GUIDELINES – Part 8
PL/SQL & SQL CODING GUIDELINES – Part 8
MessagePack - An efficient binary serialization format
MessagePack - An efficient binary serialization format
PL/SQL & SQL CODING GUIDELINES – Part 7
PL/SQL & SQL CODING GUIDELINES – Part 7
BenchmarkDotNet - Powerful .NET library for benchmarking
BenchmarkDotNet - Powerful .NET library for benchmarking
PLSQL Coding Guidelines - Part 6
PLSQL Coding Guidelines - Part 6
SonarQube - The leading platform for Continuous Code Quality
SonarQube - The leading platform for Continuous Code Quality
Visual studio 2017
Visual studio 2017
Web deploy command line
Web deploy command line
Web deploy
Web deploy
SikuliX
SikuliX
Topshelf - An easy service hosting framework for building Windows services us...
Topshelf - An easy service hosting framework for building Windows services us...
Common.logging
Common.logging
protobuf-net - Protocol Buffers library for idiomatic .NET
protobuf-net - Protocol Buffers library for idiomatic .NET
PL/SQL & SQL CODING GUIDELINES – Part 5
PL/SQL & SQL CODING GUIDELINES – Part 5
Regular expression
Regular expression
PL/SQL & SQL CODING GUIDELINES – Part 4
PL/SQL & SQL CODING GUIDELINES – Part 4
Fx.configuration
Fx.configuration
GRUNT - The JavaScript Task Runner
1.
GRUNT - THE
JAVASCRIPT TASK RUNNER Larry Nung
2.
AGENDA Introduction Requirement Install CLI How to
use Gruntfile Hello Grunt grunt-contrib-imagemin Reference Q & A 2
3.
INTRODUCTION
4.
INTRODUCTION
5.
REQUIREMENT
6.
REQUIREMENT Node.js 0.8.0
+
7.
INSTALL CLI
8.
INSTALL CLI npm
install grunt-cli -g
9.
HOW TO USE
10.
HOW TO USE Setup
project folder Init package.json Init Gruntfile.js Install grunt package Install grunt plug-in Setup task Run task
11.
HOW TO USE
Setup project folder md <folder> Init package.json npm init Init Gruntfile.js type NUL > Gruntfile.js Install grunt package npm install grunt --save-dev Install grunt plug-in npm install <plug-in> --save-dev Setup task notepad gruntfile.js Run task grunt
12.
GRUNTFILE
13.
GRUNTFILE module.exports = function(grunt)
{ grunt.initConfig({ jshint: { files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'], options: { globals: { jQuery: true } } }, watch: { files: ['<%= jshint.files %>'], tasks: ['jshint'] } }); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ['jshint']); };
14.
GRUNTFILE module.exports = function(grunt)
{ grunt.initConfig({ jshint: { files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'], options: { globals: { jQuery: true } } }, watch: { files: ['<%= jshint.files %>'], tasks: ['jshint'] } }); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ['jshint']); }; Config Task & Target Load npm package Register task
15.
GRUNTFILE module.exports = function(grunt)
{ grunt.initConfig({ jshint: { files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'], options: { globals: { jQuery: true } } }, watch: { files: ['<%= jshint.files %>'], tasks: ['jshint'] } }); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ['jshint']); }; Task Target
16.
OPTIONS Target options
> Task options > Default options
17.
FILES Compact Format
Files Object Format Files Array Format
18.
COMPACT FORMAT grunt.initConfig({ jshint: { foo:
{ src: ['src/aa.js', 'src/aaa.js'] }, }, concat: { bar: { src: ['src/bb.js', 'src/bbb.js'], dest: 'dest/b.js' }, }, });
19.
FILES OBJECT FORMAT grunt.initConfig({ concat:
{ foo: { files: { 'dest/a.js': ['src/aa.js', 'src/aaa.js'], 'dest/a1.js': ['src/aa1.js', 'src/aaa1.js'], }, }, bar: { files: { 'dest/b.js': ['src/bb.js', 'src/bbb.js'], 'dest/b1.js': ['src/bb1.js', 'src/bbb1.js'], }, }, }, });
20.
FILES OBJECT FORMAT grunt.initConfig({ concat:
{ foo: { files: { 'dest/a.js': ['src/aa.js', 'src/aaa.js'], 'dest/a1.js': ['src/aa1.js', 'src/aaa1.js'], }, }, bar: { files: { 'dest/b.js': ['src/bb.js', 'src/bbb.js'], 'dest/b1.js': ['src/bb1.js', 'src/bbb1.js'], }, }, }, }); SourceDestination
21.
FILES ARRAY FORMAT grunt.initConfig({ concat:
{ foo: { files: [ {src: ['src/aa.js', 'src/aaa.js'], dest: 'dest/a.js'}, {src: ['src/aa1.js', 'src/aaa1.js'], dest: 'dest/a1.js'}, ], }, bar: { files: [ {src: ['src/bb.js', 'src/bbb.js'], dest: 'dest/b/', nonull: true}, {src: ['src/bb1.js', 'src/bbb1.js'], dest: 'dest/b1/', filter: 'isFile'}, ], }, }, });
22.
HELLO GRUNT
23.
HELLO GRUNT var grunt
= require('grunt'); grunt.registerTask('default', '',function(){ console.log('hello world'); });
24.
HELLO GRUNT var grunt
= require('grunt'); grunt.registerTask('world', '', function(){ console.log('hello world'); }); grunt.registerTask('hello', '', function(name){ if(!name || !name.length) grunt.warn('you need to provide a name.'); console.log('hello ' + name); }); grunt.registerTask('default', ['world', 'hello:adrian']);
25.
HELLO GRUNT
26.
GRUNT-CONTRIB-IMAGEMIN
27.
GRUNT-CONTRIB-IMAGEMIN npm install
grunt-contrib-imagemin --save-dev
28.
GRUNT-CONTRIB-IMAGEMIN var grunt =
require('grunt'); grunt.initConfig({ imagemin: { main:{ options: { optimizationLevel: 3, svgoPlugins: [{ removeViewBox: false }] }, files: [{ expand: true, cwd: 'Images/', src: ['**/*.{png,jpg,gif}'], dest: 'Images/’ }] } } }); grunt.loadNpmTasks('grunt-contrib-imagemin'); grunt.registerTask('default', ['imagemin']);
29.
GRUNT-CONTRIB-IMAGEMIN
30.
REFERENCE 30
31.
REFERENCE Grunt: The
JavaScript Task Runner http://gruntjs.com/
32.
Q&A 32
33.
QUESTION & ANSWER 33
Download now