SlideShare a Scribd company logo
Task Automatisierung mit
Grunt.js
Erfan Ebrahimnia | MASSIVE ART | VlbgWebDev
SASS / LESS kompilieren

Bilder optimieren

Assets versionieren

Tests ausführen

JavaScript Linting

das wars …
Ne Spaß, es kann noch viel
mehr

CSS minifizieren

File Header Kommentar
hinzufügen
Task Automatisierung mit Grunt.js
=
Ben Alman
MAKE

RAKE
Ruby Make
Apache Ant:
<?xml version="1.0" encoding="utf-8"?>
<project name="demo" default="prod">
<!-- Concatenate JS files -->
<target name="-js.concatenate">
<concat destfile="/Users/3rfan/demo/dist/js/main.build.js"
>
<fileset dir="/Users/3rfan/demo/js/" includes="main.js"/>
</concat>
<echo>Finished</echo>
</target>
</project>
Task Automatisierung mit Grunt.js
Grunt:
module.exports = function (grunt) {
grunt.loadNpmTasks(
'grunt-contrib-uglify'
);
grunt.initConfig({
uglify: {
dist: {
files: {
'dist/main.min.js' ['js/main.js']
:
}
}
}
});
grunt.registerTask(
'build', ['uglify']);
}
Task Automatisierung mit Grunt.js
Task Automatisierung mit Grunt.js
Grunt installieren:

npm install -g grunt-cli
Benötigte Files:
Gruntfile.js
package.json
package.json
{
"name": "my-awesome-app",
"version": "0.0.0",
"devDependencies": {
"grunt": "~0.4.x"
}
}
Gruntfile:
module.exports = function (grunt) {
grunt.loadNpmTasks(
'grunt-contrib-uglify'
);
grunt.initConfig({
uglify: {
dist: {
files: {
'dist/main.min.js' ['js/main.js']
:
}
}
}
});
grunt.registerTask(
'build', ['uglify']);
}
Gruntfile:
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.initConfig({
uglify: {
dist: {
files: {
'dist/main.min.js': ['js/main.js']
}
}
}
});
grunt.registerTask('build', ['uglify']);
}
Gruntfile:
module.exports = function (grunt) {
grunt.loadNpmTasks(
'grunt-contrib-uglify'
);
grunt.initConfig({
uglify: {
dist: {
files: {
'dist/main.min.js': ['js/main.js']
}
}
}
});
grunt.registerTask('build', ['uglify']);
}
package.json
{
"name": "my-awesome-app",
"version": "0.0.0",
"devDependencies": {
"grunt": "~0.4.x"
}
}
package.json
{
"name": "my-awesome-app",
"version": "0.0.0",
"devDependencies": {
"grunt": "~0.4.x",
"grunt-contrib-uglify": "0.2.7"
}
}
Gruntfile:
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.initConfig({
uglify: {
dist: {
files: {
'dist/main.min.js' ['js/main.js']
:
}
}
}
});
grunt.registerTask('build', ['uglify']);
}
Gruntfile:
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.initConfig({
uglify: {
dist: {
files: {
'dist/main.min.js': ['js/main.js']
}
}
}
});
grunt.registerTask(
'build', ['uglify']);
}
Live Coding
Task Automatisierung mit Grunt.js
console.log('Danke!');
Task Automatisierung mit Grunt.js

More Related Content

PPTX
GRUNT - The JavaScript Task Runner
Larry Nung
 
PDF
PostCSS
Joan Leon
 
PPTX
Docker for localhost development (on Serbian)
Milan Urukalo
 
PDF
GruntJs Installation and popular plugins. MoscowJS
Dmitri Kunin
 
PDF
Евгений Гаврюшин — Генератор БЭМ-проектов на Yeoman
Yandex
 
PDF
Automated css
Hayashi Yuichi
 
PDF
Joomla in a Box – A Vagrant box for local Joomla development
Joomlatools
 
PDF
Plugins con React y la REST API (Elio Rivero, WCBA 2017)
wpargentina
 
GRUNT - The JavaScript Task Runner
Larry Nung
 
PostCSS
Joan Leon
 
Docker for localhost development (on Serbian)
Milan Urukalo
 
GruntJs Installation and popular plugins. MoscowJS
Dmitri Kunin
 
Евгений Гаврюшин — Генератор БЭМ-проектов на Yeoman
Yandex
 
Automated css
Hayashi Yuichi
 
Joomla in a Box – A Vagrant box for local Joomla development
Joomlatools
 
Plugins con React y la REST API (Elio Rivero, WCBA 2017)
wpargentina
 

What's hot (16)

PDF
Affär - inte teknik
Per Åström
 
PDF
Wordpress 24/7
Антон Еремин
 
TXT
Config
guest4f11e4
 
PDF
Gulp.js - alternatywa do Grunta
The Software House
 
PDF
Automation build
Ivanildo Silva de LIMA
 
PDF
Discover ServiceWorker
Sandro Paganotti
 
PDF
C/C++とWebAssemblyを利用したライブラリ開発
祐司 伊藤
 
PDF
用 Javascript 實現你的想像
Anna Su
 
PDF
Using Node.js for everything or what it is to write a book about it
Krasimir Tsonev
 
PDF
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
Applitools
 
PDF
Progressive Mobile Web Apps
dynamis
 
PDF
Spring Boot 소개
beom kyun choi
 
DOCX
Clustering j boss7
UAT
 
PDF
Modern Mobile Web Apps
dynamis
 
ODP
Des Templates Heiliger Gral
Alexander Schmidt
 
PDF
Firefox OS Add-on in 10 minutes
Bob Chao
 
Affär - inte teknik
Per Åström
 
Wordpress 24/7
Антон Еремин
 
Config
guest4f11e4
 
Gulp.js - alternatywa do Grunta
The Software House
 
Automation build
Ivanildo Silva de LIMA
 
Discover ServiceWorker
Sandro Paganotti
 
C/C++とWebAssemblyを利用したライブラリ開発
祐司 伊藤
 
用 Javascript 實現你的想像
Anna Su
 
Using Node.js for everything or what it is to write a book about it
Krasimir Tsonev
 
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
Applitools
 
Progressive Mobile Web Apps
dynamis
 
Spring Boot 소개
beom kyun choi
 
Clustering j boss7
UAT
 
Modern Mobile Web Apps
dynamis
 
Des Templates Heiliger Gral
Alexander Schmidt
 
Firefox OS Add-on in 10 minutes
Bob Chao
 
Ad

Task Automatisierung mit Grunt.js