More Related Content Similar to Riki Fridrich - Grunt, Gulp a spol. - Automatizáciou k maximalizácii lenivosti Similar to Riki Fridrich - Grunt, Gulp a spol. - Automatizáciou k maximalizácii lenivosti (20) Riki Fridrich - Grunt, Gulp a spol. - Automatizáciou k maximalizácii lenivosti6. var Person;
Person = (function() {
function Person(name) {
this.name = name != null ? name : 'John Doe';
}
Person.prototype.greet = function() {
return console.log("Hi! My name is " + this.name);
};
return Person;
})();
3. Profit!!!
8. module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.initConfig
watch:
files: 'coffee/*.coffee'
tasks: ['coffee']
coffee:
files:
'js/my_project.js': 'coffee/*.coffee'
Gruntfile.coffee
10. var Person;
Person = (function() {
function Person(name) {
this.name = name != null ? name : 'John Doe';
}
Person.prototype.greet = function() {
return console.log("Hi! My name is " + this.name);
};
return Person;
})();
1. Neminifikovaný kód
13. module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-cssmin'
grunt.initConfig
uglify:
files:
'js/my_project.min.js': 'js/my_project.js'
cssmin:
files:
'js/my_project.min.css': 'js/my_project.css'
Gruntfile.coffee
18. module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-contrib-imagemin'
grunt.initConfig
imagemin:
files:
expand: true
cwd: 'originals/'
src: '*.{jpg,png,gif}'
dest: 'optimized/'
Gruntfile.coffee
19. module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-svg2png'
grunt.initConfig
svg2png:
files:
src: ‘originals/*.svg'
dest: 'images/'
Gruntfile.coffee
20. module.exports = (grunt) ->
grunt.loadNpmTasks ‘grunt-responsive-images'
grunt.initConfig
responsive_images:
options:
sizes: [{width: 320}, {width: 640},{width: 1024}]
files:
expand: true
cwd: 'originals/'
src: '*.jpg'
dest: 'images/'
Gruntfile.coffee
21. module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-spritesmith'
grunt.initConfig
sprite:
src: 'originals/icons/*.png',
destImg: 'build/sprites.png',
destCSS: 'build/sprites.css'
Gruntfile.coffee
23. module.exports = (grunt) ->
...
grunt.initConfig
watch:
files: 'coffee/*.coffee'
tasks: ['coffee', 'concat', 'uglify']
1. Pomalý watch
25. module.exports = (grunt) ->
...
grunt.initConfig
watch:
files: 'coffee/*.coffee'
tasks: ['coffee']
grunt.registerTask 'build', ['coffee', 'concat', 'uglify']
3. Profit!!!
27. Ka dý si postavil devstack.ž
Kdo íká, e ne, staví ho dodneška.ř ž
— Martin Malý
40. • kó d menej náchylnýk chybám
• optimalizovanýkó d
• znovupoužite nýkomponentovýkó dľ
• open-source
• automatické testy
• zvýšenáproduktivita…
• …celého teamu
Následky automatizácie
Editor's Notes rozdeliť na veci ktoré chcete pri každej zmene
a veci ktoré chcete pred publikáciou