Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVGR preset #19

Open
shilman opened this issue Jun 27, 2019 · 2 comments
Open

SVGR preset #19

shilman opened this issue Jun 27, 2019 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@shilman
Copy link
Member

shilman commented Jun 27, 2019

We get a lot of issues relating to inline SVGs. Anybody want to write a preset for it? See e.g.

storybookjs/storybook#6758 (comment)

@shilman shilman added enhancement New feature or request good first issue Good for newcomers labels Jun 27, 2019
@hcz
Copy link
Member

hcz commented Oct 10, 2019

It seems to me it is not possible now. I have approached the problems related to this.

My storybook config contains a hack to build static files without hash in theirs names.

module.rules = module.rules.map((rule) => {
	if (rule.query && rule.query.name) {
		rule.query.name = 'static/media/[name].[ext]';
	}
	return rule;
});

This works in webpack config, but does not work inside a preset. Problem is somewhere here: https://github.com/storybookjs/storybook/blob/next/lib/core/src/server/config.js#L8
'cause webpack config builds on top of an empty object.

So config.module.rules.map from issue would not work as expected in preset.

@benedfit
Copy link

I've had a pop at one for my own personal use https://github.com/newhighsco/storybook-preset/tree/master/src/addons/preset-svgr I'd be up for collaborating on extracting it out into an official preset

It currently support inlineing of all .svg files, and as if there is the need to just use the path, as per Storybook's default behaviour, the file can be given the extension .url.svg to allow that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants