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
Esse cara é o Grunt
Search
Davidson Fellipe
December 15, 2013
Programming
9
630
Esse cara é o Grunt
Davidson Fellipe
December 15, 2013
Tweet
Share
More Decks by Davidson Fellipe
See All by Davidson Fellipe
Adventures from Enzyme to React Testing Library
fellipe
1
230
O melhor da monitoração de web performance
fellipe
0
390
Guia do Front-end das galáxias
fellipe
3
230
Workflow para desenvolvimento web e mobile usando gruntjs
fellipe
2
98
Como é trabalhar na Globo.com?
fellipe
3
90
Guia prático de desenvolvimento front-end para django devs
fellipe
1
120
Practical guide for front-end development for Django Devs
fellipe
0
58
It's Javascript Time
fellipe
6
440
Frontend Engineers: Passado, presente e futuro
fellipe
2
270
Other Decks in Programming
See All in Programming
Rubyのパフォーマンスプロファイリングの改善 / Enhancing performance profiling for Ruby
osyoyu
1
410
Polarsの成長: v0.14からv1.0までの変遷と今後の展望
zerebom
1
350
CSC307 Lecture 06
javiergs
PRO
0
360
DynamoDB コスト最適化っぽいことの基本 with Terraform
kuro_kurorrr
2
250
ぼっちを避けて楽しむためのアノテコノテ / Various Tips and Tricks to Avoid Loneliness and Have Fun
nrslib
3
1.7k
3 Effective Rules for Success with Signals in Angular
manfredsteyer
PRO
0
120
SRE チーム立ち上げ前に考えたこと・取り組んだこと / Considerations and Preparations Before Establishing an SRE Team
mackey0225
3
320
12年前の『型システム入門』翻訳の思い出話
mame
11
1.2k
入社1ヶ月でここまでやった!Findy Toolsインフラ支援の最適化
rvirus0817
6
1.4k
Rustのweb開発を助ける 便利なツール紹介
yuki0418
1
190
GraphQL はいいぞ! ~Laravel で学ぶ GraphQL 入門~
azuki
1
160
Prompt FlowによるLLMアプリケーション開発
yuto2000
1
1k
Featured
See All Featured
Writing Fast Ruby
sferik
623
60k
Fantastic passwords and where to find them - at NoRuKo
philnash
42
2.7k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
245
1.2M
Building Applications with DynamoDB
mza
89
5.8k
Building Adaptive Systems
keathley
34
2k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
224
21k
Bash Introduction
62gerente
607
210k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
20
7.2k
Art, The Web, and Tiny UX
lynnandtonic
291
20k
Bootstrapping a Software Product
garrettdimon
PRO
304
110k
Designing the Hi-DPI Web
ddemaree
276
34k
Documentation Writing (for coders)
carmenintech
63
4.2k
Transcript
grunt esse cara é o @almirfilho @davidsonfellipe
None
@almirfilho @davidsonfellipe
globo .com
do workflow rei o front-end
linha de comando nodejs automatizador de tarefas
o grunt não é o único
ant java make shell cake coffeescript rake ruby
downloads 2013
100k 200k 300k downloads 2013 nov out set ago jul
jun mai abr mar fev jan
None
automatizamos? por que
repetitivo minimizar trabalho
detalhes muitos para lembrar
conversão frameworks e libs compilação linting testes minificação
complexos útil para projetos
rodar testes pré-processadores:dev js/css lint web server scaffolding otimizar imagens
criar sprites live reloading minificação e obfuscação concatenação pré-processadores:prod gerar release deploy dev prod
eficiência! produtividade!
paz de espírito
grunt iniciando com
node.js & npm primeiro as coisas primeiras
grunt-cli instalação global instalação local configuração configuração grunt & tools
package.json Gruntfile.js
$ npm install -g grunt-cli grunt-cli instalação global
{ "name": "dave-fulero", "version": "0.1.0", "devDependencies": { "grunt": "~0.4.2", "grunt-contrib-uglify":
"~0.2.2" } } package.json configuração
$ npm install grunt & tools instalação local
--save-dev $ npm install nome-pacote --save-dev
module.exports = function(grunt){ grunt.initConfig({ pkg: grunt.file.readJSON(‘package.json’), uglify: {/* configuração da
tarefa */} }); grunt.loadNpmTasks(‘grunt-contrib-uglify’); grunt.registerTask(‘default’, [‘uglify’]); } Gruntfile.js configuração
grunt.initConfig({ uglify: { options: { banner: ‘/* dave fulêro */\n’
}, build: { src: ‘src/<%= pkg.name %>.js’, dest: ‘build/<%= pkg.name %>.min.js’ } } });
pop quem é
concatenação de arquivos a.js e.js i.js o.js u.js vogais.js
$ npm install grunt-contrib-concat --save-dev grunt-contrib-concat o cara que concatena
seus arquivos
grunt.initConfig({ concat: { options: { separator: ';', }, dist: {
src: ['src/a.js', 'src/e.js'], dest: 'build/vogais.js', } } }); concat no Gruntfile.js
$ grunt concat concatenação rodando manualmente
obfuscação e minificação de scripts all.min.js all.js
var toSeconds = function(hour) { return hour * 3600; };
var toSeconds = function(a) { return a * 3600; }; var toSeconds=function(a){return a*3600;}; obfuscação minificação
$ npm install grunt-contrib-uglify --save-dev grunt-contrib-uglify o cara que comprime
seus arquivos
grunt.initConfig({ uglify: { build: { src: 'src/all.js', dest: 'build/all.min.js' }
} }); uglify no Gruntfile.js
$ grunt uglify obfuscação e minificação rodando manualmente
pré-processadores de código widget.scss widget.css
$ npm install grunt-contrib-compass --save-dev grunt-contrib-compass o cara que compila
seu sass
grunt.initConfig({ compass: { dev: { options: { sassDir: 'src/scss', cssDir:
'build/css', imagesDir: 'src/img', generatedImagesDir: 'build/img' } }, prod: { /* ... */ } }}); compass no Gruntfile.js
grunt.initConfig({ compass: { dev: { /* ... */ }, prod:
{ options: { sassDir: 'src/scss', cssDir: 'build/css', imagesDir: 'src/img', generatedImagesDir: 'build/img', outputStyle: 'compressed', noLineComments: true }}}}); compass no Gruntfile.js
$ grunt compass:dev compilação de sass $ grunt compass:prod rodando
manualmente
pré-processadores grunt-contrib-sass sass stylus less coffeescript grunt-contrib-stylus grunt-contrib-less grunt-contrib-coffee
testes automatizados specs sucesso erro
$ npm install grunt-contrib-jasmine --save-dev grunt-contrib-jasmine o cara que testa
seu código e te avisa
grunt.initConfig({ jasmine: { src: 'src/**/*.js', options: { specs: 'spec/*Spec.js', helpers:
'spec/*Helper.js' } } }); jasmine no Gruntfile.js
$ grunt jasmine rodando manualmente testes automatizados
suites de testes grunt-contrib-jasmine jasmine mocha qunit grunt-simple-mocha grunt-contrib-qunit
watch fique de olho widget.scss widget.css save file all.min.js all.js
$ npm install grunt-contrib-watch --save-dev grunt-contrib-watch o cara que vigia
tudo para você
grunt.initConfig({ watch: { build: { files: ['src/**/*.{scss, js}'], tasks: [
'compass:dev', 'concat', 'uglify' ] } } }); watch no Gruntfile.js
testes pré-processadores js/css lint criar sprites live reloading concatenação tarefas
comuns para watch
na prática globo esporte setup
6 semanas!
faça suas escolhas sabiamente
globo .com /talentos github.com/globocom/ IWantToWorkAtGloboCom
obrigado!
obrigado! /almirfilho /almirfilho /davidsonfellipe /davidsonfellipe
obrigado!