SlideShare a Scribd company logo
1 of 24
Download to read offline
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
=
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>
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']);
}
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
console.log('Danke!');
Task Automatisierung mit Grunt.js

More Related Content

What's hot

Affär - inte teknik
Affär - inte teknikAffär - inte teknik
Affär - inte teknikPer Åström
 
Gulp.js - alternatywa do Grunta
Gulp.js - alternatywa do GruntaGulp.js - alternatywa do Grunta
Gulp.js - alternatywa do GruntaThe Software House
 
C/C++とWebAssemblyを利用したライブラリ開発
C/C++とWebAssemblyを利用したライブラリ開発C/C++とWebAssemblyを利用したライブラリ開発
C/C++とWebAssemblyを利用したライブラリ開発祐司 伊藤
 
用 Javascript 實現你的想像
用 Javascript 實現你的想像用 Javascript 實現你的想像
用 Javascript 實現你的想像Anna Su
 
Using Node.js for everything or what it is to write a book about it
Using Node.js for everything or what it is to write a book about itUsing Node.js for everything or what it is to write a book about it
Using Node.js for everything or what it is to write a book about itKrasimir Tsonev
 
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.jsPayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.jsApplitools
 
Progressive Mobile Web Apps
Progressive Mobile Web AppsProgressive Mobile Web Apps
Progressive Mobile Web Appsdynamis
 
Clustering j boss7
Clustering j boss7Clustering j boss7
Clustering j boss7UAT
 
Modern Mobile Web Apps
Modern Mobile Web AppsModern Mobile Web Apps
Modern Mobile Web Appsdynamis
 
Firefox OS Add-on in 10 minutes
Firefox OS Add-on in 10 minutesFirefox OS Add-on in 10 minutes
Firefox OS Add-on in 10 minutesBob Chao
 

What's hot (16)

Affär - inte teknik
Affär - inte teknikAffär - inte teknik
Affär - inte teknik
 
Wordpress 24/7
Wordpress 24/7Wordpress 24/7
Wordpress 24/7
 
Config
ConfigConfig
Config
 
Gulp.js - alternatywa do Grunta
Gulp.js - alternatywa do GruntaGulp.js - alternatywa do Grunta
Gulp.js - alternatywa do Grunta
 
Automation build
Automation buildAutomation build
Automation build
 
Discover ServiceWorker
Discover ServiceWorkerDiscover ServiceWorker
Discover ServiceWorker
 
C/C++とWebAssemblyを利用したライブラリ開発
C/C++とWebAssemblyを利用したライブラリ開発C/C++とWebAssemblyを利用したライブラリ開発
C/C++とWebAssemblyを利用したライブラリ開発
 
用 Javascript 實現你的想像
用 Javascript 實現你的想像用 Javascript 實現你的想像
用 Javascript 實現你的想像
 
Using Node.js for everything or what it is to write a book about it
Using Node.js for everything or what it is to write a book about itUsing Node.js for everything or what it is to write a book about it
Using Node.js for everything or what it is to write a book about it
 
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.jsPayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
PayPal's NemoJS and Applitools Eyes - Visual Testing with Node.js
 
Progressive Mobile Web Apps
Progressive Mobile Web AppsProgressive Mobile Web Apps
Progressive Mobile Web Apps
 
Spring Boot 소개
Spring Boot 소개Spring Boot 소개
Spring Boot 소개
 
Clustering j boss7
Clustering j boss7Clustering j boss7
Clustering j boss7
 
Modern Mobile Web Apps
Modern Mobile Web AppsModern Mobile Web Apps
Modern Mobile Web Apps
 
Des Templates Heiliger Gral
Des Templates Heiliger GralDes Templates Heiliger Gral
Des Templates Heiliger Gral
 
Firefox OS Add-on in 10 minutes
Firefox OS Add-on in 10 minutesFirefox OS Add-on in 10 minutes
Firefox OS Add-on in 10 minutes
 

Task Automatisierung mit Grunt.js