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)

Commits related to this issue

Most upvoted comments

Found a workaround - add this to _config.yml - this disables the generation of CSS source maps and the CSS is generated again:

sass:
    sourcemap: never

(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 a FrozenError on my machine.

Glad to hear it! I’m closing this issue as fixed then 👍

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 toggling sass: sourcemap: never?

After using the cmd bundle update to update polyglot to 1.6.0, I can build my site without problems, thanks!

Is there any workaround for this? Got stuck on this FrozenError .

I’m not familiar with Ruby. So I asked ChatGPT and followed its instruction to replace doc.output.gsub! to doc.output.gsub for the last four functions of site.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 toggling sass: 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:

exclude_from_localization: [
    "assets",
    "images"
]

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 only assets/xxx.css produces the JSON like the above while the plugin is enabled.


Turns out it happens without @imports from the _scss folder too. Simple SCSS can reproduce it - such as putting in assets/test.scss:

body {
    background: red;
    
    p {
        color: white;
    }
}

The output _site/assets/test.css becomes:

{
	"version": 3,
	"file": "test.css",
	"sources": [
		"test.scss"
	],
	"sourcesContent": [
		"body {\n    background: red;\n    \n    p {\n        color: white;\n    }\n}\n\n"
	],
	"names": [],
	"mappings": "AAAA,AAAA,IAAI,CAAC,EACD,UAAU,EAAE,GAAG,GAKlB;;AAND,AAGI,IAHA,CAGA,CAAC,CAAC,EACE,KAAK,EAAE,KAAK,GACf"
}