我正在开发一个项目,而不是由我编写的,gulp文件可以在其中进行iconify任务。我将svg文件放在图像中,然后任务将这些svg文件转换为scss / sass。现在,当我运行该任务时,它已经给了我一段时间的TypeError,并且真的很麻烦,有时会花费很多时间。
以下是gulpfile.js中iconify的代码
var iconparams = {
src: './public/styles/images/icons/*.svg',
pngOutput: false,
scssOutput: './public/styles/sass',
scssSvgName: '_icons.scss',
cssOutput: false,
styleTemplate: './public/styles/icons.scss.mustache'
}
gulp.task('iconify',function() {
iconify(iconparams);
});
当我运行gulp iconify
时,我收到此输出并显示错误:
[18:31:08] Starting 'iconify-clean'...
[18:31:08] Finished 'iconify' after 7.55 ms
[18:31:08] Finished 'iconify-clean' after 41 ms
[18:31:08] Starting 'iconify-convert'...
[18:31:20] Finished 'iconify-convert' after 12 s
[18:31:20] Starting 'iconify-fallback'...
path.js:8
throw new TypeError('Path must be a string. Received ' +
^
TypeError: Path must be a string. Received false
at assertPath (path.js:8:11)
at Object.posix.relative (path.js:495:3)
at Stream.bufferContents (/home/savitoj/Work/mercureup/node_modules/gulp-iconify/lib/iconify.js:108:41)
at Stream.stream.write (/home/savitoj/Work/mercureup/node_modules/through/index.js:26:11)
at write (/home/savitoj/Work/mercureup/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:623:24)
at flow (/home/savitoj/Work/mercureup/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (/home/savitoj/Work/mercureup/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:664:5)
at emitNone (events.js:80:13)
at DestroyableTransform.emit (events.js:179:7)
at emitReadable_ (/home/savitoj/Work/mercureup/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:448:10)
at emitReadable (/home/savitoj/Work/mercureup/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:444:5)
我已经在Stackoverflow上检查了有关此类型错误的其他questions,但没有针对此问题的解决方案。我看到./public/styles/sass
中的输出已创建但在输出_icons.scss
之前发出错误。提前谢谢。
答案 0 :(得分:0)
是的,所以我在仔细阅读错误后想出了解决方案,但正如我所说,我从其他人那里收到了这段代码。正如它所说TypeError: Path must be a string. Received false
。
我将行改为
cssOutput: './public/styles/css',
它解决了这个问题。我非常紧张,因为这让我感到困扰了很长一段时间,我无法弄明白。