When using `gulp-iconfont` with `gulp-iconfont-css`, the `prependUnicode` config is not working.
Closed this issue · 6 comments
var iconfont = require('gulp-iconfont');
var iconfontCss = require('gulp-iconfont-css');
var fontName = 'iconfont';
var runTimestamp = Math.round(Date.now() / 1000);
gulp.task('iconfont', function () {
gulp.src(['iconfont/input/*.svg'])
.pipe(iconfontCss({
fontName: fontName,
path: 'iconfont/input/iconfont-template.css',
targetPath: fontName + '.css',
fontPath: '../fonts/',
cssClass: 'icon',
timestamp: runTimestamp
}))
.pipe(iconfont({
fontName: fontName,
formats: ['ttf', 'eot', 'woff', 'woff2', 'svg'],
prependUnicode: true,
timestamp: runTimestamp
}))
.pipe(gulp.dest('iconfont/output'));
});
If I comment the first pipe off, the prependUnicode
works fine.
Thanks for reporting. Would be nice to give us the actual error you got and his stack trace.
I suspect gulp-iconfont-css of changing file's pathes. If it is a suitable behavior, we should then allow to set a relative path option to gulp-iconfont.
In all case, won't be able to investigate this without more information, preferably with a simple project that reproduce this behavior.
https://github.com/lzl124631x/iconfont-bug You can clone this repo, npm install
to install gulp, gulp-iconfont and gulp-iconfont-css, then gulp iconfont
. You will see the name of account-o.svg is unaltered after the command.
Am I using it wrong?
@lzl124631x looks like this is a real bug but on the gulp-iconfont-css side ;).
From my tests, i can see that the files path are already prefixed by gulp-iconfont-css before being passed to gulp-iconfont so it assumes your files are already prefixed and in consequence they aren't renamed.
You chould resubmit this issue in gulp-iconfont-css and link it to here.
I'm not sure I understand the issue, @lzl124631x. gulp-iconfont-css
will already prepend the unicode to the filename, so what is the reason to let gulp-iconfont
do the same thing again? I think you can just disable prependUnicode
there. Or am I missing something?
Sorry just realized that I forgot to check in iconfont-template.css
.
@backflip gulp-iconfont-css
didn't prepend unicode to filename in my case. Do you mean that gulp-iconfont-css
will prepend unicode to filename by default? The readme doesn't say anything about it, nor does gulp-iconfont-css
provide an option for prependUnicode
.
Let's move the discussion to backflip/gulp-iconfont-css#40