-
Notifications
You must be signed in to change notification settings - Fork 922
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
[Plugins] Combine build()
and transform()
#542
Comments
I found a way to support svg react component, which needs to extend the source code a little. Adding the following code at https://github.com/pikapkg/snowpack/blob/master/src/commands/build-util.ts#L153 (neglecting a bit changes in function params syntax...)
which makes the plugin control proxy response. thus, we can add a svg plugin maybe sth like this:
In this way, xxx.svg.proxy.js returns the react code for svg instead of Hi @FredKSchott I have no idea whether this is the proper way to support svg react component. Any thoughts? |
Thanks @chengcyber! The work we just merged in #567 will allow for this via something like:
Or, if you only want to run this on a certain set of ".module.svg" files, you could use This isn't quite supported yet, but the interface is now in place to support this in the near future. |
Right now these two plugin methods do essentially the same thing, but with the limitation that there can only ever be one
build()
per file type (and that build is able to transform file types).We should combine these two into a single method (
build()
,transform()
, or something else entirely) with the following qualities:code
/filename
strings.foo.svg
->foo.js
orfoo.svg.js
orfoo-svg.js
(entirely up to the plugin, although we can provide recommendations)The text was updated successfully, but these errors were encountered: