SlideShare a Scribd company logo
1 of 92
Download to read offline
@andismith
About Me
Andi Smith
Technical Architect

@ AKQA

!
- andismith.com

- devtoolsecrets.com

- @andismith
The Perfect Experience
- For our users

- For us?
The Challenge
Find the perfect workflow
Did I Succeed?
- Well, no.

- One size does not fit all.
The Perfect Workflow?
Depends on your
requirements.
Project Requirements
It needs to be
content editable.
Client Requirements
It needs to use our
current CMS.
Hosting Requirements
It will be hosted in a
Java environment.
Your Requirements
I’d prefer to use
Sass over LESS.
IMPROVE
@andismith
Points to Consider
- Less repetition

- Less errors

- Better performance
Automation = More Fun!
Credit: giphy.com/gifs/tscu52qG7VbwI
Less Pain!
Credit: giphy.com/gifs/XOxay70W2WHbq
How?!
SETUP
DEVELOP
BUILD
SETUP
@andismith
Choose a Task Runner
Credit: flickr.com/photos/nomadic_lass/6970307781/
Task Runners
bit.ly/1jPCxeN
Intro to Task Runners
Which to Use?
Which to Use?
Easy to start with

Stable

2000+ plugins

Yeoman Support

Slower than
competitors.
+

+

+

+

-
Grunt
Which to Use?
Fast

No need to temp
store files

Less mature than
Grunt
+

+

!
-
Gulp
Your Choice
- Checklist of requirements

- Check tasks are available
and working

- Grunt is more mature, so
less risk
Scaffold Your Workflow
Get a head start
with Yeoman

!
yeoman.io
Generating a Base
Choosing a Base
- yo webapp

!
- yo assemble

- yo firefox-os

- yo phonegap

- yo wordpress

!
yeoman.io/community-generators.html
Customise!
Credit: sailorusagichan.deviantart.com/art/Batmobile-Lawn-mower-310787147
Source !== Destination
Don’t overwrite your work!
src!
- html
- css
- javascript
- sass
dest!
- html
- css (min)
- javascript (min)
Loading Tasks…
grunt.loadNpmTasks(‘grunt-contrib-connect’);
grunt.loadNpmTasks(‘grunt-contrib-clean’);
grunt.loadNpmTasks(‘grunt-contrib-copy’);
grunt.loadNpmTasks(‘grunt-contrib-sass’);
grunt.loadNpmTasks(‘grunt-contrib-watch’);
grunt.loadNpmTasks(‘grunt-autoprefixer');
npm install load-grunt-tasks
Auto Load Tasks
Load tasks from
package.json
npm install gulp-load-plugins
Auto Load Tasks (Grunt)
grunt.loadNpmTasks(‘grunt-contrib-copy’);
grunt.loadNpmTasks(‘grunt-contrib-watch’);
grunt.loadNpmTasks(‘grunt-contrib-connect’);
grunt.loadNpmTasks(‘grunt-autoprefixer');
grunt.loadNpmTasks('grunt-sass');
require('load-grunt-tasks')(grunt);
Before:
After:
Auto Load Tasks (Gulp)
var connect = require(‘gulp-connect’);
var jshint = require(‘gulp-jshint’);
var concat = require(‘gulp-concat’);
var plugins = require(‘gulp-load-
plugins’)();
// plugins.jshint
Before:
After:
npm install

grunt-contrib-connect
Start a Local Server
Host locally without
additional software
npm install gulp-connect
Start a Local Server
connect: {
dev: {
options: {
base: ‘./dest’,
port: 4000
}
}
},
In Grunt:
Start a Local Server
gulp.task(‘connect',
connect.server({
root: ‘./dest’,
port: 4000
})
);
In Gulp:
npm install time-grunt
Workflow Performance
Time your tasks
npm install gulp-duration
Workflow Performance
npm install grunt-concurrent
Make Grunt Faster
Run tasks concurrently
Make Grunt Faster
grunt.initConfig({
concurrent: {
compile: ['coffee', 'sass']
}
});
!
grunt.registerTask('default',
['concurrent:compile');
SETUP
- Scaffold Your Workflow

- Source !== Destination

- Auto Load Tasks

- Start a Local Server

- Time your Tasks

- Run Tasks Concurrently
DEVELOP
@andismith
Performance
Credit: Me!
Focus on
Speed up/help dev

Speed up workflow

!
NOT concatenating or
obfuscating code
Ask Yourselves
What is the task?

Do you need it?

Do you really need it?
CSS Prefixes
-moz-transition: -moz-transform 200ms;
-ms-transition: -ms-transform 200ms;
-o-transition: -o-transform 200ms;
-webkit-transition: -webkit-transform
200ms;
transition: transform 200ms;
npm install grunt-autoprefixer
Use Autoprefixer
Automatically add CSS
vendor prefixes
npm install gulp-autoprefixer
Use Autoprefixer
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
Source:
Output:
npm install

grunt-contrib-watch
Watch & LiveReload
Watch for changes and
auto-refresh the browser
gulp.watch
Watch & LiveReload
Split your watch into
smaller groups
watch: {
options: {
livereload: true },
sass: {
files: PATHS.SRC + PATHS.SASS + ‘{,*/}*.scss',
tasks: [‘styles'] },
scripts: {
files: PATHS.SRC + PATHS.JS + '{,*/}*.js',
tasks: [‘scripts'] }
Globbing Performance
images/**/*.{gif,jpg,png}
images/{,*/}*.{gif,jpg,png}
Before:
After:
More: bit.ly/1g2Rar8
Watch & LiveReload
- Chrome:

bit.ly/1ojCxVq

- Firefox:

bit.ly/1hs7yBT

- Safari: 

bit.ly/1sbwfcC
npm install grunt-newer
Compile Changed Files
Make compilation more
efficient
npm install gulp-changed
Compile Changed Files
Prefix “newer:” to your
task in Grunt.
watch: {
options: {
livereload: true },
sass: {
files: PATHS.SRC + PATHS.SASS + ‘{,*/}*.scss',
tasks: [‘newer:styles’] },
scripts: {
files: PATHS.SRC + PATHS.JS + '{,*/}*.js',
tasks: [‘newer:scripts’] }
Compile Changed Files
Add .pipe(changed(dest))
in Gulp
gulp.src([PATHS.SRC + PATHS.SASS + '{,*/}*.scss'])
.pipe(changed(PATHS.DEST + PATHS.SASS))
.pipe(sass())
Live Editing Our Files
Make changes in the browser by
setting up source maps
sass: {
options: {
sourcemap: true,
style: ‘compressed',
trace: true
},
dist: {
...
}
}
Live Editing Our Files
Enable source maps in Chrome
Developer Tools settings
Live Editing Our Files
Allow Developer Tools to access
your source in Settings,
Workspace
Live Editing Our Files
Map our CSS file to our SASS file.
Live Editing Our Files
CSS Style Inspector shows line
numbers
npm install grunt-responsive-images
Grunt Responsive Images
Resize images
automatically for <picture>

!
brew install graphicsmagick
Grunt Responsive Images
responsive_images: {
images: {
options: {
sizes: [{
height: 320, name: “small", width: 400
}, {
height: 768, name: “medium", width: 1024
}, {
height: 980, name: “large", width: 1280
}]
},
files: [{
...
}]
},
DEVELOP
- Autoprefixer

- Watch & LiveReload

- Improve your Globbing
Performance

- Newer/Changed files

- Live editing CSS/JavaScript

- Grunt Responsive Images
BUILD
@andismith
For build & release
- Slower, optimisation tasks.

- Make sure you test a build with
these tasks before go-live!
npm install grunt-usemin
UseMin
Compile CSS/JS and replace
references in HTML.
npm install gulp-usemin
UseMin
<!-- build:css /css/main.css -->
<link rel="stylesheet" href=“/css/main.css" />
<link rel="stylesheet" href=“/css/carousel.css" />
<link rel="stylesheet" href=“/css/forum.css" />
<!-- endbuild -->
HTML:
UseMin
grunt.registerTask('minify', [
‘useminPrepare',
‘concat',
‘cssmin',
‘uglify',
‘usemin'
]);
Grunt file:
npm install

grunt-combine-media-queries
Combine Media Queries
Reduce file size with 1
media query per breakpoint
npm install

gulp-combine-media-queries
h1 {
margin: 10px;
@media screen and (min-width: 800px) {
margin: 20px;
}
}
!
p {
font-size: 1.2em;
@media screen and (min-width: 800px) {
font-size: 1.4em;
}
}
Sass:
Combine Media Queries
h1 { margin: 10px; }
!
@media screen and (min-width: 800px) {
h1 { margin: 20px; }
}
!
p { font-size: 1.2em; }
!
@media screen and (min-width: 800px) {
p { font-size: 1.4em; }
}
CSS:
Combine Media Queries
h1 { margin: 10px; }
p { font-size: 1.2em; }
!
@media screen and (min-width: 800px) {
h1 { margin: 20px; }
p { font-size: 1.4em; }
}
After:
Combine Media Queries
npm install grunt-uncss
UnCss
Remove unused CSS
npm install gulp-uncss
npm install grunt-modernizr
Streamline Modernizr
Create at build time
npm install gulp-modernizr
npm install grunt-imagemin
Minify Your Images
Reduce image file size
npm install gulp-imagemin
npm install grunt-contrib-compress
Compress Your Files
Reduce your file size so
your users download less.
npm install gulp-gzip
npm install grunt-zopfli
Zopfli
Improved compression, but
slower.

brew install zopfli
npm install gulp-zopfli
Shrinkwrap
Lock your task
dependencies.

!
npm shrinkwrap
BUILD
- UseMin

- Combine Media Queries

- Remove Unused CSS

- Streamline Modernizr

- Minify Your Images

- Compress

- Shrinkwrap Your Dependencies
…
That’s a lot of things!
Credit: flickr.com/photos/jason-samfield/5654182142
Is it?
- Most require minimal
setup.

- Avoid mistaeks.
But…
- Don’t include tasks you
don’t need.
A better workflow
SETUP
DEVELOP
BUILD
PERFECT?
@andismith
Sample CSS Workflow
Sass Compliation
Watch
Autoprefixer
Combine Media
Queries
UseMin
Live Editing
UnCSS
Newer
Build
Develop
Compress
Sample JS Workflow
JSHint
Watch
Compress
Live Editing
Modernizr
Newer
Build
Develop
UseMin
A better workflow
SETUP
DEVELOP
BUILD
THANKS
@andismith
- Slides/Blog:

http://j.mp/qftpw

- My site:

http://andismith.com

More Related Content

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

The Quest for the Perfect Workflow