Skip to content

Instantly share code, notes, and snippets.

@kazu69
Created March 18, 2014 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazu69/9617529 to your computer and use it in GitHub Desktop.
Save kazu69/9617529 to your computer and use it in GitHub Desktop.
{
"name": "svg-sprites",
"version": "0.0.1",
"description": "",
"author": "",
"license": "MIT",
"devDependencies": {
"grunt": "^0.4.4",
"grunt-svgstore": "0.0.2",
"load-grunt-tasks": "^0.4.0",
"time-grunt": "^0.2.10",
"grunt-php": "~0.3.2"
}
}
'use strict'
module.exports = (grunt) ->
require('load-grunt-tasks') grunt
require('time-grunt') grunt
grunt.initConfig
svgstore:
defaults:
options:
prefix: 'shape-'
files:
'processed/svg-defs.svg': ['source/*.svg']
php:
dist:
options:
hostname: '0.0.0.0'
port: 9000
keepalive: true
open: true
grunt.registerTask 'default', ['svgstore']
<!DOCTYPE html>
<html>
<head>
<title>svg</title>
<style type="text/css" media="screen">
iframe {
width: 0;
height: 0;
border: 0;
}
#source svg {
display: none;
}
.icon {
width: 75px;
height: 75px;
}
body {
padding: 20px;
}
#shape-codepen path:first-child {
fill: #999;
}
#shape-codepen path:nth-child(2) {
fill: #666;
}
.shape-codepen-2 {
-webkit-filter: drop-shadow(5px 5px 2px #ccc);
filter: drop-shadow(5px 5px 2px black);
}
.shape-youtube {
fill: url(#gradient);
}
.shape-twitter-2 {
fill: #55ACEE
}
.shape-twitter-3 {
fill: red;
}
</style>
</head>
<body>
<div id="source">
<?php include_once("processed/svg-defs.svg"); ?>
</div>
<svg viewBox="0 0 100 100" class="icon shape-codepen">
<use xlink:href="#shape-codepen"></use>
</svg>
<svg viewBox="0 0 100 100" class="icon shape-codepen-2">
<use xlink:href="#shape-codepen"></use>
</svg>
<svg viewBox="0 0 100 100" class="icon shape-youtube">
<linearGradient id="gradient" gradientUnits="userSpaceOnUse" x1="0%" y1="0%" x2="0%" y2="100%">
<stop stop-color="#FF0000" offset="0"/><stop stop-color="#571C1C" offset="1"/>
</linearGradient>
<use xlink:href="#shape-youtube"></use>
</svg>
<svg viewBox="0 0 100 100" class="icon shape-twitter">
<use xlink:href="#shape-twitter"></use>
</svg>
<svg viewBox="0 0 100 100" class="icon shape-twitter-2">
<use xlink:href="#shape-twitter"></use>
</svg>
<svg viewBox="0 0 100 100" class="icon shape-twitter-3">
<use xlink:href="#shape-twitter"></use>
</svg>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment