svg with grunticon

26
SVG with Grunticon by Matt Vanderpol Presented at SmashingConf SF 2016 Jam Session

Upload: matt-vanderpol

Post on 09-Feb-2017

207 views

Category:

Internet


3 download

TRANSCRIPT

Page 1: SVG with Grunticon

SVG with Grunticonby Matt Vanderpol

Presented at SmashingConf SF 2016 Jam Session

Page 2: SVG with Grunticon

Personally

Page 3: SVG with Grunticon

Professionally

• Full Stack

• Custom WordPress themes

• Performance and Mobile

Page 4: SVG with Grunticon

Overview

• SVG Rocks

• Grunticon Intro

• Examples

• Grunticon and Sass

Page 5: SVG with Grunticon

SVG Intro/Review

• Vector

• Plain text

• Swiss Army Image Format

By W3C, CC BY 2.5, https://commons.wikimedia.org/w/index.php?curid=1895005

Page 6: SVG with Grunticon

Vector

Page 7: SVG with Grunticon

Plain text

Page 8: SVG with Grunticon

Swiss Army Chainsaw

Photo Credit: https://500px.com/photo/55320074/swiss-army-chainsaw-knife-by-christian-edgar-schmidt

Page 9: SVG with Grunticon

Grunticon

• What?

• Who?

• How?

Page 10: SVG with Grunticon

Setting Up• npm • grunt • svg files

Page 11: SVG with Grunticon

Config Options of Note

cssprefix customselectors

corsEmbed enhanceSVG

compressPNG

Page 12: SVG with Grunticon

Grunticon Use Cases

• Background Images

• Foreground Images

Page 13: SVG with Grunticon

BackgroundDefault usage

CSS background image No default height Works w/out JS

Page 14: SVG with Grunticon

ForegroundInject SVG into the markup

Allows styling Requires JavaScript

Page 15: SVG with Grunticon

Examples

• Color Change

• Animation

Page 16: SVG with Grunticon

Color Change

Screen Capture from http://www.grunticon.com

Page 17: SVG with Grunticon

AnimationWith JavaScript

With CSS

Page 18: SVG with Grunticon

Something Missing…

• Hover effect

• Semantic classnames

Page 19: SVG with Grunticon

Grunticon and Sass - Easy Right?

• Generate Sass files

• Most bits in place

Photo Credit: https://www.flickr.com/photos/mattijn/4419973636/

Page 20: SVG with Grunticon

Challenges

• Individual Sass files for “variable stacks”

• Preview template to pull it together

• Differentiate variable types

• Helpers to get “sprite” data

Page 21: SVG with Grunticon

Grunticon SVG via Sass!

• When it’s working it’s great

• Modernizr for svg support

Page 22: SVG with Grunticon
Page 23: SVG with Grunticon

Pitfalls

• File protocol

• Height/width in SVG

• Need hooks in SVG for styling

• Class Manipulation

• MinificationPhoto Credit: https://www.flickr.com/photos/7951075@N03/3639157564/

Page 24: SVG with Grunticon

Recap

• SVG is a great image format

• Grunticon makes it easy

• A few tweaks make it better

Page 25: SVG with Grunticon

Icons

• https://pixelbuddha.net/freebie/25-design-and-shapes-icons

• https://useiconic.com/open

Page 26: SVG with Grunticon

Resources• https://github.com/bookwyrm/

grunticon-example

• http://www.grunticon.com/

• https://css-tricks.com/inline-svg-grunticon-fallback/

• https://sarasoueidan.com/tags/svg/index.html

• https://github.com/filamentgroup/gulpicon

Matt Vanderpol @bookwyrm