Last active
August 29, 2015 14:10
-
-
Save lajlev/dab9c57818bca6ea677b to your computer and use it in GitHub Desktop.
Script to optimize & combine SVG files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
require('load-grunt-tasks')(grunt) | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
svgmin: { | |
dist: { | |
expand: 'true', | |
cwd: 'images/source', | |
src: ['*.svg'], | |
dest: 'images/optimized' | |
} | |
}, | |
svgstore: { | |
options: { | |
prefix : 'icon-', | |
cleanup: true, | |
includedemo: true, | |
svg: { | |
style: "display:none;" | |
} | |
}, | |
default: { | |
files: { | |
"images/svg-defs.svg": ["images/optimized/*.svg"] | |
} | |
} | |
} | |
}) | |
grunt.log.writeln(['end']) | |
grunt.registerTask('default', ['svgmin', 'svgstore']) | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "svg-optimize-combine", | |
"version": "0.1.0", | |
"devDependencies": { | |
"grunt": "^0.4.5", | |
"grunt-svgmin": "^2.0.0", | |
"grunt-svgstore": "^0.4.1", | |
"load-grunt-tasks": "^1.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment