Top Banner
d’oh ! with grunt avoid annoyances
49

D'oh! Avoid annoyances with Grunt.

Jul 14, 2015

Download

Technology

Paul Schreiber
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: D'oh! Avoid annoyances with Grunt.

d’oh! with gruntavoid annoyances

Page 2: D'oh! Avoid annoyances with Grunt.

Paul Schreiber

Page 3: D'oh! Avoid annoyances with Grunt.
Page 4: D'oh! Avoid annoyances with Grunt.
Page 5: D'oh! Avoid annoyances with Grunt.
Page 6: D'oh! Avoid annoyances with Grunt.
Page 7: D'oh! Avoid annoyances with Grunt.
Page 8: D'oh! Avoid annoyances with Grunt.
Page 9: D'oh! Avoid annoyances with Grunt.

✔ code change

Page 10: D'oh! Avoid annoyances with Grunt.

✔ code change✔ syntax check

Page 11: D'oh! Avoid annoyances with Grunt.

✔ code change✔ syntax check✔ lint

Page 12: D'oh! Avoid annoyances with Grunt.

✔ code change✔ syntax check✔ lint✔ minify

Page 13: D'oh! Avoid annoyances with Grunt.

✔ code change✔ syntax check✔ lint✔ minify✔ concatenate

Page 14: D'oh! Avoid annoyances with Grunt.
Page 15: D'oh! Avoid annoyances with Grunt.

installing grunt

using grunt

gotchas

Page 16: D'oh! Avoid annoyances with Grunt.

installing grunt

using grunt

gotchas

Page 17: D'oh! Avoid annoyances with Grunt.

installing grunt

install node

install grunt

install in project

Page 18: D'oh! Avoid annoyances with Grunt.

nodejs.org/download

Page 19: D'oh! Avoid annoyances with Grunt.

sudo%npm%install%-g%grunt-cli

Page 20: D'oh! Avoid annoyances with Grunt.

sudo%gem%install%compass

Page 21: D'oh! Avoid annoyances with Grunt.

sudo%pear%install%PHP_CodeSniffer

Page 22: D'oh! Avoid annoyances with Grunt.

npm%install

Page 23: D'oh! Avoid annoyances with Grunt.

Gruntfile.js package.json assets/ css/ js/ header.php footer.php ...

Page 24: D'oh! Avoid annoyances with Grunt.

js/ src/ vendor/ foo.src.js foo.min.js

Page 25: D'oh! Avoid annoyances with Grunt.

css/ sass/ foo.src.scss foo.src.css foo.min.css

Page 26: D'oh! Avoid annoyances with Grunt.

installing grunt

using grunt

gotchas

Page 27: D'oh! Avoid annoyances with Grunt.

$ grunt

Page 28: D'oh! Avoid annoyances with Grunt.

$ grunt watch

Page 29: D'oh! Avoid annoyances with Grunt.

$ grunt task_name

Page 30: D'oh! Avoid annoyances with Grunt.
Page 31: D'oh! Avoid annoyances with Grunt.

Syntax Check Linter Minify Concat

PHP php -l phpcs —

CSS compass cssmin

JS jshint uglify concat

Page 32: D'oh! Avoid annoyances with Grunt.

commitchange

Page 33: D'oh! Avoid annoyances with Grunt.

grunt commitchange

Page 34: D'oh! Avoid annoyances with Grunt.

commit CSS/JSgrunt commitchange

Page 35: D'oh! Avoid annoyances with Grunt.

using grunt

gotchas

installing grunt

Page 36: D'oh! Avoid annoyances with Grunt.
Page 37: D'oh! Avoid annoyances with Grunt.

$ git diff

Page 38: D'oh! Avoid annoyances with Grunt.

$ git diff✗ banner

Page 39: D'oh! Avoid annoyances with Grunt.

diff --cc assets/js/admin.src.jsindex 85018e9,ff5fdc7..0000000--- a/assets/js/admin.src.js+++ b/assets/js/admin.src.js@@@ -1,4 -1,4 +1,4 @@@ -/*! FiveThirtyEight - v0.1.0 - 2014-11-21 -/*! FiveThirtyEight - v0.1.0 - 2014-12-05++/*! FiveThirtyEight - v0.1.0 - 2014-12-09 * * Copyright (c) 2014; * Licensed GPLv2+ */ (function (window, $, fteContributors) {

Page 40: D'oh! Avoid annoyances with Grunt.

$ git checkout assets/src/admin.src.js

Page 41: D'oh! Avoid annoyances with Grunt.

$ git merge

Page 42: D'oh! Avoid annoyances with Grunt.

$ git merge✗ minified files

Page 43: D'oh! Avoid annoyances with Grunt.

Auto-merging assets/js/admin.src.css CONFLICT (content): Merge conflict in assets/js/admin.src.css Auto-merging assets/js/admin.min.css CONFLICT (content): Merge conflict in assets/js/admin.min.css Automatic merge failed; fix conflicts and then commit the result.

Page 44: D'oh! Avoid annoyances with Grunt.

$ rm assets/js/admin.*.css $ grunt css $ git commit -a

Page 45: D'oh! Avoid annoyances with Grunt.

$ gem update

Page 46: D'oh! Avoid annoyances with Grunt.

$ gem update✗ CSS

Page 47: D'oh! Avoid annoyances with Grunt.

diff --git a/assets/css/burrito.src.css b/assets/css/burrito.src.cssindex c87230e..748cd49 100644--- a/assets/css/burrito.src.css+++ b/assets/css/burrito.src.css@@ -104,14 +104,14 @@ iframe[scrolling="no"] { overflow: hidden; }-#table-view table tbody.orange tr:first-child td { background: -moz-linear-gradient(top, #ffffff 95%, rgba(255, 110, 39, 0+#table-view table tbody.orange tr:first-child td { background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBl

Page 48: D'oh! Avoid annoyances with Grunt.

$ git commit

Page 49: D'oh! Avoid annoyances with Grunt.