Preprocessor Workflow with Grunt

39
Preprocessor Workflow with Grunt CSS Dev Conference 2013 / Vlad Filippov

description

Preprocessor Workflow with Grunt

Transcript of Preprocessor Workflow with Grunt

Page 1: Preprocessor Workflow with Grunt

Preprocessor Workflow with Grunt

CSS Dev Conference 2013 / Vlad Filippov

Page 2: Preprocessor Workflow with Grunt

@vladikoff

Page 3: Preprocessor Workflow with Grunt

Agenda

• Grunt - What and Why?

• Getting Started

• Grunt Plugins and CSS Workflows

• Beyond the plugins

+

Page 4: Preprocessor Workflow with Grunt

What is Grunt?

Task Runner

open browser

minify CSS

processSASS

optimizeimages

run tests

. . .

Page 5: Preprocessor Workflow with Grunt

What is Grunt?

Automationopen

browser

minify CSS

processLESS

optimizeimages →

→{→

Page 6: Preprocessor Workflow with Grunt

What is Grunt?

Build Step

→→→→

Debug

→Source Production

Development

Page 7: Preprocessor Workflow with Grunt

What is Grunt?

• Built and Configured using JavaScript

• Powered by

• Cross-platform

• Strength in community & open-source

• Strength in modularity

Page 8: Preprocessor Workflow with Grunt

Who uses Grunt?

Page 10: Preprocessor Workflow with Grunt

Grunt Ecosystem

• Stable Version: 0.4.1

• 0.4.2 out in the next few days!

• Over 1000 plugins available today

Page 11: Preprocessor Workflow with Grunt

Demo

Page 12: Preprocessor Workflow with Grunt

Getting Started

Page 13: Preprocessor Workflow with Grunt

Empty Gruntfile

Page 14: Preprocessor Workflow with Grunt

Grunt Plugins!

Page 15: Preprocessor Workflow with Grunt

Grunt Plugins!

Grunt Plugins and Grunt Core in node_modules

Install the plugin we want:

Page 16: Preprocessor Workflow with Grunt

Make it easy to install

$ npm install grunt-contrib-less --save-dev

Page 17: Preprocessor Workflow with Grunt

Make it easy to install

Ready to be installed everywhere!

Page 18: Preprocessor Workflow with Grunt

grunt-contrib-less

Page 19: Preprocessor Workflow with Grunt

grunt-contrib-stylus

Page 20: Preprocessor Workflow with Grunt

grunt-contrib-sass

Page 21: Preprocessor Workflow with Grunt

grunt-contrib-compass

Page 22: Preprocessor Workflow with Grunt

File Patterns

Page 23: Preprocessor Workflow with Grunt

Run it!

Page 24: Preprocessor Workflow with Grunt

So far...

→ SASS:dev

SASS:prod→

Page 25: Preprocessor Workflow with Grunt

grunt-contrib-watch

Page 26: Preprocessor Workflow with Grunt

grunt-contrib-watch

Page 27: Preprocessor Workflow with Grunt

Workflow!

→ SASS:dev

SASS:prod→

watchfor

changes

default

development →

Page 28: Preprocessor Workflow with Grunt

grunt-spritesmith

Page 29: Preprocessor Workflow with Grunt

grunt-contrib-imagemin

Page 30: Preprocessor Workflow with Grunt

build

Workflow Updated!

→ SASS:dev

SASS:prod→

watchfor

changes

default

dev →

createsprites→build optimize

images →

build →

Page 31: Preprocessor Workflow with Grunt

Workflow Updated!

Page 32: Preprocessor Workflow with Grunt

grunt-source

Reuse a Grunt environment across multiple projects

Project A Project B Project C

Boilerplate Project

Page 33: Preprocessor Workflow with Grunt

So much to do...

• Explore task combinations, optimize

• Give feedback to existing plugins

• Share your workflow

• Build your own plugins• Plugin Template: github.com/gruntjs/grunt-init

Page 34: Preprocessor Workflow with Grunt

Beyond the plugins

Page 35: Preprocessor Workflow with Grunt

Beyond the plugins

Page 36: Preprocessor Workflow with Grunt

Beyond the plugins

Page 37: Preprocessor Workflow with Grunt

Beyond the plugins

Page 38: Preprocessor Workflow with Grunt
Page 39: Preprocessor Workflow with Grunt

Thank you!

• Documentation and API at gruntjs.com

• Stackoverflow: [gruntjs]

• IRC: #grunt on Freenode

• Twitter: @gruntjs and #gruntjs