@hugsmidjan/gulp-iconfont
v0.4.3
Published
iconfont gulp task
Downloads
11
Readme
@hugsmidjan/gulp-iconfont
npm install --save-dev @hugsmidjan/gulp-iconfont
Usage
const [cssBundle, cssWatch] = require('@hugsmidjan/gulp-iconfont')(opts);
API / Advanced usage
const iconfontTaskFactory = require('@hugsmidjan/gulp-iconfont');
const options = {
// These are the defaults:
name: 'iconfont', // the display name of the generated tasks
src: 'src/',
dist: 'pub/i/',
glob: 'iconfont/*.svg', // which files to use as entry points
fontName: 'icons',
// scssFile: '', // `options.src`-relative path, including filename
// lessFile: '', // `options.src`-relative path, including filename
// varPrefix: fontName + '-', // Custom prefix for less/css variables.
// onGlyphs: null, // (glyphs:{ name: string, unicode: string[]}, options: object) => void
};
// Create the gulp tasks based on the above options.
const iconfontTasks = iconfontTaskFactory(options);
// iconfontTasks is a two item array...
const [iconfontBundle, iconfontWatch] = iconfontTasks;
// ...but it also exposes the tasks as named properties.
const { bundle, watch } = iconfontTasks;
This task generates a set of font-files along with the JSON file
{{options.fontName}}.json
which can be consumed by scripts or other tasks.
The scssFile
and lessFile
options generate LESS/SCSS files with the icon
glyps as named variables.