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

Remove unneeded files in lib/mermaid #1588

Merged
merged 6 commits into from
Jul 9, 2024
Merged

Remove unneeded files in lib/mermaid #1588

merged 6 commits into from
Jul 9, 2024

Conversation

wtchangdm
Copy link
Contributor

Some context: #980 (comment)

There was a finding that assets/lib/mermaid takes ~90MiB size. After digging the history a little, I am still curious why all files were included again:

  1. It was only mermaid.min.js until 7740790.
  2. Mermaid was removed from dependencies at 7e41c9c
  3. Mermaid was re-introduced in 5a11829, with full folder copy command in package.json along with many other files

However, after checking the code that includes mermaid:

{{ if .Page.HasShortcode "mermaid" }}
{{ $mermaidLib := resources.Get "lib/mermaid/mermaid.min.js" }}
{{ $mermaidConfig := resources.Get "js/mermaid.js" }}
{{ $mermaidConfig := $mermaidConfig | resources.Minify }}
{{ $mermaidJS := slice $mermaidLib $mermaidConfig | resources.Concat "js/mermaid.bundle.js" | resources.Fingerprint "sha512" }}

Looks like what we need here is only mermaid.min.js.

Therefore I created this PR to remove the unneeded files and reduce the folder size from 90MiB to 3.3MiB.

This should benefit users using blowfish as hugo module and the ones who only shallow-clones the repo.

@nunocoracao please let me know if I missed anything.

Thanks!

@wtchangdm
Copy link
Contributor Author

Oops, just found out I should fork from dev branch and send PR to it instead.

@wtchangdm wtchangdm changed the base branch from main to dev July 2, 2024 10:00
@wtchangdm
Copy link
Contributor Author

The last two commits were caused by mistake as I was testing the result hugo module but changed the module name on wrong branch and have fixed it.

@nunocoracao nunocoracao merged commit 3d07a23 into nunocoracao:dev Jul 9, 2024
2 checks passed
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.

2 participants