grunt-svgtojs v0.1.0
grunt-svgtojs
Transform SVG sprite to JS file
Getting Started
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-svgtojs --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-svgtojs');
The "svgtojs" task
Overview
In your project's Gruntfile, add a section named svgtojs
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
svgtojs: {
options: {
// Task-specific options go here.
}
},
});
Options
options.src
Type: String
Default value: 'svg-defs.svg'
Set the input SVG file
options.dest
Type: String
Default value: 'svgi-sprite.js'
Set the output JS file
options.className
Type: String
Default value: 'svgi-sprite'
Set the class attribute of wrapper
Usage Examples
Default Options
This example will transform src
into the dest
grunt.initConfig({
svgtojs: {
options: {
src: 'svg-defs.svg',
dest: 'svgi-sprite.js',
className: 'svgi-sprite'
}
},
});
Release History
0.0.1
- Initial release
8 years ago