grunt-iconprocessor-imweb-tpl v1.0.0
grunt-iconprocessor-imweb-tpl
extract all icon names from imweb-tpl files, and generate iconfont files according to these names.
Generation below:
*outputDir* fonts iconfont.eot iconfont.svg iconfont.woff iconfont.ttf iconfont.scss
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-iconprocessor-imweb-tpl --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-iconprocessor-imweb-tpl');
The "iconprocessor_imweb_tpl" task
Overview
In your project's Gruntfile, add a section named iconprocessor_imweb_tpl
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
iconprocessor_imweb_tpl: {
options: {
// Task-specific options go here.
svgDir: 'svgs/',
outpurDir: 'output/',
styleFile: 'main.scss'
},
src: [
// html, tpl, vm files
]
},
});
Options
options.svgDir
Type: String
Default: 'svgs'
This option specific svgs folder. By default, it is 'svgs' in root folder.
This svgs folder will be checked. If it not exists then task will clone svgs from the iconfont
options.outputDir
Type: String
Default: No default
This option specific output folder. Grunt error happens if not config.
A string value that is used to store generated files.
options.styleFile
Type: String
Default: No default
This option specific your base sass file in output folder. Grunt error happens if not config.
A string value that is used to append the below code to the top of base sass file:
@import 'iconfont.scss';
Usage Examples
In this example, the options are used to specify local svg folder is 'svgs/'.
grunt.initConfig({
iconprocessor_imweb_tpl: {
options: {
svgPath: 'common/svgs/',
outputDir: 'static/css/',
styleFile: 'main.scss'
},
files: {
src: ['src/*\*/\*.html']
},
},
});
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Release History
- 2015-08-12 v0.1.0 Initial release.
- 2015-08-13 v0.1.1 fix regexp and some other bugs and speed up execute time.
- 2015-08-18 v0.2.0 add clone svgs from iconfont and update task in async.