- What's your focus / work?
- What was the last thing you found challenging/frustrating in SASS
#SVG with SASS and Gulp#
Let's start downloading stuff during intro...
##Setup prerequisites##
xcode-select --install
Download from http:// node.js
###Download Demo Project ###
Current: http://bit.ly/sassto-4-demo
There's 1 line of PHP in there... We can avoid with a crappy "copy 'n paste" if you can't get PHP working locally.
Open terminal and cd to your root project folder.
$ (sudo) gem install bundler
$ bundle install --path vendor/bundle
Test it works...
$ bundle exec compass watch
sudo npm install -g gulp
$ (sudo) npm install
Test it works...
They just text files!
- Retina Proof
- Scaleable
- 1 request (is the goal)
I thought I'd be showing this article's technique but it doesn't work (one of the packages is outdated)
How to export from illustrator http://demosthenes.info/blog/823/SVG-Export-Settings-For-Adobe-Illustrator
https://www.liquidlight.co.uk/blog/article/creating-svg-sprites-using-gulp-and-sass/
index.php
sass/compontents/_icon-css-svg.scss
images/css-svg-source <<Our source svg icons
images/css-svg-min <<Minified versions
- SVG's are added as backgrounds to CSS with inline-image compass function
- It's important to use these as placeholders so you only import the image data 1 time
- The more images you add the slower your compile time
- Each color variation needs to be duplicated = bloat.
https://github.com/twistdigital/gulp-svgo (crap looks like it's depricated... Anyways you get the idea - Optimize your SVG before using them)
Run...
gulp svg-min
// SVG as inline background images http://www.filamentgroup.com/lab/grumpicon-workflow.html
index.php
sass/compontents/_icon-inline-svg.scss
images/svg-source <<Our source svg icons
images/svg-sprite <<Minified versions
https://github.com/jonathantneal/svg4everybody
Was added to before the closing [body]> tag
(nothing new here execept the command in chained in gulp
Run...
gulp svg-sprite
images/svg-source/*.svg into this file... images/svg-sprite/sprite.svg
- Chris Coyier reported the svg must be the 1st tag after the head
If you can't run index.php just rename to .html and copy the svg spite on top of
/index.php
<?php include_once("images/svg-sprite/sprite.svg"); ?>
repaced with images/svg-sprite/sprite.svg
<a href="#" class="link-red">
<svg class="icon--inline-svg"><title>Facebook</title><use xlink:href="#facebook" /></svg>
Ipad help!</a>
http://css-tricks.com/svg-symbol-good-choice-icons/ http://24ways.org/2014/an-overview-of-svg-sprite-creation-techniques/ https://kartikprabhu.com/article/inline-svg-icons