Last active
February 9, 2016 23:12
-
-
Save jpdevries/5a23555a6741bff5bf5b to your computer and use it in GitHub Desktop.
SVG-Sprite Gruntfile
This file contains 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) { | |
// Project configuration. | |
var initConfig = { | |
pkg: grunt.file.readJSON('package.json'), | |
dirs: { /* just defining some properties */ | |
lib: './lib/', | |
theme: '../', | |
assets: 'assets/', | |
img: 'img/' | |
}, | |
bower: { | |
install: { | |
options: { | |
targetDir: './lib', | |
layout: 'byComponent' | |
} | |
} | |
}, | |
copy: { | |
'font-awesome-svg-png-svg':{ | |
src: '<%= dirs.lib %>/font-awesome-svg-png/svg/*.svg', | |
dest: '<%= dirs.theme %><%= dirs.assets %><%= dirs.img %>src/svg/', | |
expand: true, | |
flatten: true | |
}, | |
'font-awesome-svg-png-png':{ | |
src: '<%= dirs.lib %>/font-awesome-svg-png/png/*.png', | |
dest: '<%= dirs.theme %><%= dirs.assets %><%= dirs.img %>src/png/', | |
expand: true, | |
flatten: true | |
} | |
}, | |
svgstore: { | |
icons: { | |
files: { | |
'<%= dirs.theme %><%= dirs.assets %><%= dirs.img %>icons.svg': ['<%= dirs.theme %><%= dirs.assets %><%= dirs.img %>src/svg/*.svg'] | |
}, | |
options: { | |
formatting : { | |
indent_size : 2 | |
}, | |
prefix: 'icon-', | |
cleanup: true, | |
convertNameToId: function(name) { | |
return name.replace(/^\w+\_/, ''); | |
} | |
} | |
} | |
} | |
}; | |
grunt.initConfig(initConfig); | |
grunt.loadNpmTasks('grunt-bower-task'); | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.loadNpmTasks('grunt-svgstore'); | |
grunt.registerTask('prebuild', ['bower', 'copy', 'svgstore']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment