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

Fix SVG embedding + prepare for development #8

Merged
merged 7 commits into from Jan 21, 2022
Merged

Conversation

samueldr
Copy link
Member

@samueldr samueldr commented Jan 17, 2022

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:

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.
@samueldr
Copy link
Member Author

The CI build seems to be broken...

samueldr added a commit to NixOS/nixos-homepage that referenced this pull request Jan 17, 2022
Comment on lines +7 to +11
let filename = filenameNode.value;
const {currentDirectory} = this.currentFileInfo;
const fullFilename = path.join(currentDirectory, filename);

return readFileSync(fullFilename);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting to be reviewed

@nixos-discourse
Copy link

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

@garbas garbas self-requested a review January 21, 2022 13:51
@garbas
Copy link
Member

garbas commented Jan 21, 2022

I've tested the build locally and I'll fix the github workflow in a separate PR

@garbas garbas merged commit 82f0583 into main Jan 21, 2022
@garbas garbas deleted the feature/fix-svg-embed branch January 21, 2022 14:12
@nixos-discourse
Copy link

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

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

Successfully merging this pull request may close these issues.

None yet

3 participants