我对咕噜和节点js很陌生。我面临着使用grunt- svg -sprite模块创建svg精灵的问题。我使用咕噜-svg-雪碧模块来创建sprite映像。我已经使用以下命令安装了咕噜-svg-雪碧模块。
npm install grunt-svg-sprite --save-dev我使用下面的行在我的grunt.js文件中启用了插件。
grunt.loadNpmTasks('grunt-svg-sprite'); 我的插件配置如下
svg_sprite : {
basic : {
// Target basics
expand : true,
cwd : 'images/svg-logo/',
src : 'images/svg-logo/*.svg',
dest : 'out/',
// Target options
options : {
mode : {
css : { // Activate the «css» mode
render : {
css : true // Activate CSS output (with default options)
}
}
}
}
}
},下面给出了我的文件夹结构
Project_folder
├───css
├───Images
│ └───svg-logo
├───GruntFile.js
├───html
├───node_modules
├───include
├───package.json当我运行以下命令时,我会收到成功消息,但没有创建任何文件夹。
发布于 2015-04-02 06:12:21
这里一切都很好。src应该只指定那里的文件。试试这个。
svg_sprite : {
basic : {
expand : true,
cwd : 'images/svg-logo',
src : ['**/*.svg'],
dest : 'out',
options : {
mode : {
css : {
render : {
css : true
},
},
},
},
},
},https://stackoverflow.com/questions/29406000
复制相似问题