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
Fix SVG embedding + prepare for development #8
Conversation
The viewbox caused the wedge to not render as expected when directly embedded in the CSS.
This adds a less function that *directly* transcludes the content of a file as a string. In turn, this will be used to replace the clumsy SVG embedding during the build process.
In addition, using `"g"` in `replace()` fixes a *well-hidden* set of bugs where it was possible to miss replacements and actually have broken results.
Since we're not embedding clumsily anymore, we're not optimizing those files eagerly anymore. This shouldn't be an issue, as consumers *should* optimize SVG files, but in the off chance they don't, let's optimize them eagerly again.
The CI build seems to be broken... |
let filename = filenameNode.value; | ||
const {currentDirectory} = this.currentFileInfo; | ||
const fullFilename = path.join(currentDirectory, filename); | ||
|
||
return readFileSync(fullFilename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting to be reviewed
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2022-01-19-marketing-meeting-minutes/17209/1 |
I've tested the build locally and I'll fix the github workflow in a separate PR |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2022-02-02-marketing-meeting-minutes/17542/1 |
This uses a
less
plugin to read SVG files rather than clumsily embedding them with a script.This speeds up the dev cycle a lot.
The main unsolved issue, and would be solved in the actual consumer, is how to optimize the SVG assets in development use. For production use it's already solved.
See: