README
gulp-css-iconfont
Generate (S)CSS file for icon font created with Gulp
Respect
This package is fork of Thomas Jaggi's and Nicolas Froidure's gulp-css-iconfont
Usage
First, install gulp-iconfont
and gulp-css-iconfont
as development dependencies:
npm install --save-dev gulp-iconfont gulp-css-iconfont
Then, add it to your gulpfile.js
. Important: gulp-css-iconfont
has to be inserted before piping the files through gulp-iconfont
.
var iconfont = require('gulp-iconfont');
var iconfontCss = require('gulp-css-iconfont');
var fontName = 'Icons';
gulp.task('iconfont', function(){
gulp.src(['app/assets/icons/*.svg'])
.pipe(iconfontCss({
fontName: fontName,
path: 'app/assets/css/templates/_icons.scss',
targetPath: '../../css/_icons.scss',
fontPath: '../../fonts/icons/'
}))
.pipe(iconfont({
fontName: fontName
}))
.pipe(gulp.dest('app/assets/fonts/icons/'));
});
gulp-css-iconfont
works well with gulp-iconfont
but you can use it in a more modular fashion by directly using gulp-svgicons2svgfont
, gulp-svg2tff
, gulp-ttf2eot
, gulp-ttf2woff
and/or gulp-ttf2woff2
.
API
iconfontCSS(options)
options.fontName
Type: String
The name of the generated font family (required). Important: Has to be identical to iconfont's fontName
option.
options.path
Type: String
The template path (optional, defaults to css
template provided with plugin).If set to 'scss'
, 'styl'
or 'less'
, the corresponding default template will be used. See templates
options.targetPath
Type: String
The path where the (S)CSS file should be saved, relative to the path used in gulp.dest()
(optional, defaults to _icons.css
). Depennding on the path, it might be necessary to set the base
option, see https://github.com/backflip/gulp-css-iconfont/issues/16.
options.fontPath
Type: String
Directory of font files relative to generated (S)CSS file (optional, defaults to ./
).
options.cssClass
DEPRECATED - use cssSelector
Type: String
Name of the generated CSS class/placeholder. Used for mixins and functions, too. See https://github.com/backflip/gulp-css-iconfont/tree/master/templates. Default is icon
.
options.cssSelector
Type: String
Name of the generated CSS selector. Default is .icon
.
options.separator
Type: String
Separator for the generated CSS class/placeholder. Default is -
.
options.engine
Type: String
The template engine to use (optional, defaults to lodash
).
See https://github.com/visionmedia/consolidate.js/ for available engines. The engine has to be installed before using.
License
Copyright (c) 2016 Alexander Krivoshhekov
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.