polyglot: SCSS generation broken in Jekyll 4.0
Hi, I was testing an update to Jekyll 4.0 but found this plugin causes Jekyll to generate invalid CSS files from SCSS files. Luckily, i18n pages and variables appear to be working as expected.
For example, if the project has SCSS includes inside _scss
and assets/example.scss
contains:
---
---
@import "example1.scss";
@import "example2.scss";
After updating the bundle, the output for example.css
becomes something like this:
{
"version": 3,
"file": "example.css",
"sources": [
"example1.scss",
"example2.scss"
],
"sourcesContent": [
...
],
"names": [],
"mappings": "....."
}
Disabling the plugin allows SCSS to generate as expected.
I’m unfamiliar with Ruby, but I would guess it’s due to these changes new in 4.0:
I see from this project’s README that only 3.0 is currently supported, but it would be grand if 4.0 works too, it’s an excellent i18n plugin! 👍 Thanks in advance.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 19 (8 by maintainers)
Found a workaround - add this to
_config.yml
- this disables the generation of CSS source maps and the CSS is generated again:(Thanks for the hint @cmcnicholas, I didn’t realise the output is the CSS sourcemap)
@tusharj9 @Sycamost I tried to fix the frozen string issue and have made a pull request. Please feel free to try my temporary solution.
Update: the workaround seems to only work for Jekyll <=4.2. From Jekyll 4.3.0, setting
sass: sourcemap: never
leads to aFrozenError
on my machine.Glad to hear it! I’m closing this issue as fixed then 👍
After using the cmd
bundle update
to update polyglot to1.6.0
, I can build my site without problems, thanks!I’m not familiar with Ruby. So I asked ChatGPT and followed its instruction to replace
doc.output.gsub!
todoc.output.gsub
for the last four functions ofsite.rb
.It works for me now. But I’m not sure if it’s the right way to resolve this.
yeah worked for me as well. Thanks for the quick turn around.
can someone who uses scss test with the recently deployed jekyll-polyglot-1.6.0 gem, and confirm they’re no longer seeing the
FrozenError
thrown when togglingsass: sourcemap: never
?I have the same issue, the output of the css files becomes the css sourcemap, disabling this plugin and everything works.
Thanks - I did forget to mention that my
_config.yml
is ignoring those folders:Adding
_scss
to the list yields the same results.So, even though the plugin doesn’t generate files like
/fr/assets/xxx.css
, the one and onlyassets/xxx.css
produces the JSON like the above while the plugin is enabled.Turns out it happens without
@import
s from the_scss
folder too. Simple SCSS can reproduce it - such as putting inassets/test.scss
:The output
_site/assets/test.css
becomes: