Closed jonespen closed 8 years ago
@jonespen Hello!
Can you try 3.0.0-alpha.2 version? documentation here https://github.com/mrsum/webpack-svgstore-plugin/blob/feature/refactor/README.md
Hey, thanks!
I upgraded, and it works, but I still can't figure out how to specify two different templates. AFAIK svgxhr don't take a template as parameter
Hi @jonespen i don't understand what you mean about 'templates'
jade/pug template for compiling data to svg, or different sprites by mask?
Wherever, if you want compile 2 or more different sprites, you can use
var __svg__ = { path: './svg/folder-1/*.svg', name: 'assets/svg/[hash].icons.svg' };
require('webpack-svgstore-plugin/src/helpers/svgxhr')(__svg__);
var __svg__ = { path: './svg/folder-2/*.svg', name: 'assets/svg/[hash].logos.svg' };
require('webpack-svgstore-plugin/src/helpers/svgxhr')(__svg__);
Jade/pug template. If this could be customizable, I could create a html file with all the icons in the svgstore.
I can have a look at it (not right now) if you want
@jonespen You can set up template
new SvgStore({
template: 'path/to/your/pug/template.pug'
})
var __svg__ = { path: './svg/folder-1/*.svg', name: 'assets/svg/[hash].icons.svg' }; require('webpack-svgstore-plugin/src/helpers/svgxhr')(__svg__);
var __svg__ = { path: './svg/folder-2/*.svg', name: 'assets/svg/[hash].logos.svg' }; require('webpack-svgstore-plugin/src/helpers/svgxhr')(__svg__);
Can I use something like this, but in config (not in chunk)?
new SvgStore(
//=========> input path
[
path.join(__dirname + 'public/', 'image/svg_icons/market', '*.svg'),
path.join(__dirname + 'public/', 'image/svg_icons/portable', '*.svg'),
],
//=========> output path
[
path.join(__dirname + 'public/', 'image/svg_sprite/market'),
path.join(__dirname + 'public/', 'image/svg_sprite/portable'),
],
//=========> options
{
name: 'sprite.svg',
chunk: 'portable.styl',
prefix: 'svg-',
}
)
By the way, I can not get the plugin to work. There is no output. Maybe I need to write input path and output path with considering output.path?
Is it possible to generate multiple sprite files? I'm creating a styleguide, and it would be nice to output a sprite.html (using custom
template
) with all the icons.When trying the following code
I get the following error:
It works fine with one instance.
Btw, great project 💯