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 sass quoted string interpolation for hugo 0.110.0 #1566

Merged
merged 8 commits into from Mar 25, 2023

Conversation

dherbst
Copy link
Contributor

@dherbst dherbst commented Jan 20, 2023

if $bootstrap-icons-font-file: "#{$bootstrap-icons-font-dir}/#{$bootstrap-icons-font}" !default; is unquoted then it results in src:url('./fonts/"bootstrap-icons".woff2?24e3eb84d0bcaf83d77f904c78ac1f47' with the quotes in hugo 0.110.0 extended.

fixes #1378, fixes #1538, fixes #1574

@nubecoder
Copy link

I believe these wrapping quotes also need to be applied here:
https://github.com/twbs/icons/blob/main/build/font/scss.hbs#L3

@dherbst
Copy link
Contributor Author

dherbst commented Jan 26, 2023

Ok, I added the same change to build/font/scss.hbs. My guess it is used for the fantasticicon part of the build. This change isn't necessary for fixing the hugo scss compiler issue, but it keeps the two files in sync.

@yoshitomo-matsubara
Copy link

Hi @dherbst
Thank you for the fix! I've been waiting for this PR being merged since January.

@mdo Can this PR be merged soon and included as part of next release?
I'm using Hugo + GitHub action for auto install/build, so this fix is important

@XhmikosR XhmikosR requested a review from mdo March 22, 2023 06:23
@XhmikosR
Copy link
Member

@mdo can you check this PR and the related linked issues? Unsure if this the fix but judging by the issues there might be a real problem somewhere :)

@XhmikosR XhmikosR changed the title fix for #1378 to fix sass quoted string interpolation for hugo 0.110.0 Fix sass quoted string interpolation for hugo 0.110.0 Mar 22, 2023
@XhmikosR XhmikosR added the build label Mar 22, 2023
@XhmikosR
Copy link
Member

Please don't touch the dist file and don't revert our changes.

@dherbst
Copy link
Contributor Author

dherbst commented Mar 22, 2023

@XhmikosR unfortunately you removed the fix in ea46c09, so I added it back. We need the quotes around

$bootstrap-icons-font-file: "#{$bootstrap-icons-font-dir}/#{$bootstrap-icons-font}" !default;

Because the sass compiler that hugo uses does not interpolate the quotes from $bootstrap-icons-font and $bootstrap-icons-font correctly.

If we do not add the quotes around $bootstrap-icons-font-file then you end up with a file that has the extra quotes in it like this:

font-family:bootstrap-icons;src:url('./fonts/"bootstrap-icons".woff2?24e3eb84d0bcaf83d77f904c78ac1f47')format("woff2"),
url('./fonts/"bootstrap-icons".woff?24e3eb84d0bcaf83d77f904c78ac1f47')format("woff")

and the extra quotes break the url.

@XhmikosR
Copy link
Member

No we don't need it manually. The file is auto-generated so just revert the change like I did

@dherbst
Copy link
Contributor Author

dherbst commented Mar 22, 2023

The file is auto-generated so just revert the change like I did

Ok. I'll revert it.

@dherbst
Copy link
Contributor Author

dherbst commented Mar 22, 2023

Cool, I ran the build process locally and I see the fix changes:

> bootstrap-icons@1.10.3 icons-font
> fantasticon

Generating font kit...
✔ Using configuration file: .fantasticonrc.js
✔ 1953 SVGs found in ./icons
✔ Generated ./font/fonts/bootstrap-icons.woff2
✔ Generated ./font/fonts/bootstrap-icons.woff
✔ Generated ./font/bootstrap-icons.css
✔ Generated ./font/bootstrap-icons.scss
✔ Generated ./font/bootstrap-icons.json
Done
$ head -5 font/bootstrap-icons.scss
$bootstrap-icons-font: "bootstrap-icons" !default;
$bootstrap-icons-font-dir: "./fonts" !default;
$bootstrap-icons-font-file: "#{$bootstrap-icons-font-dir}/#{$bootstrap-icons-font}" !default;
$bootstrap-icons-font-hash: "24e3eb84d0bcaf83d77f904c78ac1f47" !default;
$bootstrap-icons-font-src: url("#{$bootstrap-icons-font-file}.woff2?#{$bootstrap-icons-font-hash}") format("woff2"),

@XhmikosR XhmikosR added the bug Something isn't working label Mar 25, 2023
@mdo mdo merged commit d10633c into twbs:main Mar 25, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build
Projects
No open projects
Status: Done
5 participants