Merge pull request #46 from locomotivemtl/mcaskill-svg-sprite

Added 'grunt-svg-sprite' plugin
This commit is contained in:
Chauncey McAskill
2016-09-07 18:24:06 -04:00
committed by GitHub
9 changed files with 32 additions and 37 deletions

View File

@@ -32,5 +32,4 @@ module.exports = function (grunt)
} }
} }
}); });
}; };

View File

@@ -17,8 +17,7 @@
"browserify:prod", "browserify:prod",
"concat:prod", "concat:prod",
"uglify", "uglify",
"svgstore", "svg_sprite",
"svgmin",
"notify:build" "notify:build"
], ],

View File

@@ -0,0 +1,29 @@
module.exports = {
options : {
svg: {
xmlDeclaration : false,
namespaceIDs : true,
doctypeDeclaration : false,
cleanupNumericValues : true,
removeTitle : true,
removeDesc : true
}
},
prod: {
expand : true,
cwd : '<%= paths.img.src %>',
src : [ '**/*.svg', '!sprite.svg' ],
dest : '<%= paths.img.dist %>',
options : {
mode: {
symbol: {
dest : '.',
sprite : 'sprite.svg',
example : {
dest: '../../../build/sprite.symbol.html'
}
}
}
}
}
}

View File

@@ -1,22 +0,0 @@
module.exports = {
options: {
plugins: [
{ removeViewBox: false },
{ cleanupIDs: false },
{ convertPathData: false },
{ mergePaths: false },
{ convertShapeToPath: false },
{ cleanupNumericValues: false },
{ convertTransform: false },
{ removeUselessStrokeAndFill: false },
{ removeTitle: true },
{ removeDesc: true }
]
},
dist: {
expand : true,
cwd : '<%= paths.img.dist %>',
src : '*.svg',
dest : '<%= paths.img.dist %>'
}
};

View File

@@ -1,8 +0,0 @@
module.exports = {
options: {},
prod: {
files: {
'<%= paths.img.dist %>/sprite.svg': [ '<%= paths.img.src %>/sprite/*.svg' ]
}
}
};

View File

@@ -13,7 +13,7 @@ module.exports = {
}, },
svg: { svg: {
files: [ '<%= paths.img.src %>/**/*.svg' ], files: [ '<%= paths.img.src %>/**/*.svg' ],
tasks: [ 'svgstore', 'notify:svg' ] tasks: [ 'svg_sprite', 'notify:svg' ]
}, },
tasks: { tasks: {
options: { options: {

View File

@@ -24,8 +24,7 @@
"grunt-phplint": "0.0.0", "grunt-phplint": "0.0.0",
"grunt-postcss": "0.0.0", "grunt-postcss": "0.0.0",
"grunt-sass": "0.0.0", "grunt-sass": "0.0.0",
"grunt-svgmin": "0.0.0", "grunt-svg-sprite": "0.0.0",
"grunt-svgstore": "0.0.0",
"load-grunt-config": "0.0.0", "load-grunt-config": "0.0.0",
"postcss-banner": "0.0.0", "postcss-banner": "0.0.0",
"svg4everybody": "0.0.0" "svg4everybody": "0.0.0"

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg"/>

Before

Width:  |  Height:  |  Size: 41 B