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

[NPM Scripts] SVG minification isn't configurable/overrideable #9

Open
ryansalerno opened this issue Mar 27, 2018 · 0 comments
Open

Comments

@ryansalerno
Copy link

We're using imagemin-cli in order to keep things simple and lightweight. But imagemin-cli doesn't allow you to pass options to its underlying compression tools, so its version of SVGO will always strip classes and IDs for you, even if they're important to something you're planning on doing with said SVG....

Maybe we should handle SVGs differently so we can run them through SVGO on our own? It's a slight bummer to include an essentially duplicate set of dependencies just to call a tool with different parameters. And also (overlapping slightly with #8) we have the issue of where these snowflake files should live:

  • Do we try to parse the extension in the NPM script and pass it to the appropriate handler based on what returns? 🕳️

  • Do we have an svg folder and act on it differently? but stripping everything is the most common use-case, so really, it would be a folder (and set of rules) just for the occasion that you had an SVG that you didn't want stripped?

Current workarounds (and our issues with them):

  • Re-adding the stuff you need after the SVG gets compressed. 💣 Don't do this! 💣 It'll get clobbered and recompressed every time any file gets added/changed per [NPM Scripts] Image minification granularity of changes #7.

  • You can compress it by hand and manually put it somewhere else in lib. But this goes against the pattern of only touching src and so feels pretty icky. Plus it may require .gitignore fiddling, and could run afoul of the clean script that empties lib/assets depending on where you try to put it.

  • Linking directly to the file somewhere in src (whether you put it somewhere outside the toolchain or just ignore the improperly-compressed version created in lib). But that's inconsistent and also doesn't feel great given our attempts at separating sources from compiled assets....

  • Stop building websites and go to work on a farm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant