Skip to content

Switch from sassc to jekyll-sass-embedded for faster builds #2551

@rolfedh

Description

@rolfedh

Summary

The site depends on the sassc gem (pulled in by jekyll-sass-converter 2.x). The sassc gem includes a native C++ extension that must be compiled from source during bundle install, which takes 1-2 minutes and is the single biggest bottleneck in local site setup and CI gem installation.

Suggestion

Switch to Dart Sass via the sass-embedded gem. The cleanest way is to bump jekyll-sass-converter to ~> 3.0: it dropped sassc in favor of sass-embedded in v3.0.0. (Note: there is no jekyll-sass-embedded gem.) Dart Sass ships prebuilt platform-specific binaries, so installation completes in seconds with no native compilation step.

Benefits

  • Faster local setup: Eliminates the sassc native extension compilation (~1-2 min savings per fresh bundle install)
  • Faster CI builds: Same benefit applies to CI pipelines that install gems from scratch
  • Better Sass compatibility: Dart Sass is the primary Sass implementation and receives new features first. LibSass (which sassc wraps) has been deprecated since 2020.
  • Simpler build dependencies: No C/C++ compiler toolchain needed for gem installation

Current state

The Gemfile already pins Jekyll 4.4.1 and an explicit converter:

gem "jekyll", "~> 4.4.1"
gem "jekyll-sass-converter", "~> 2.0"

Jekyll 4.4.1 already allows jekyll-sass-converter (>= 2.0, < 4.0), so no Jekyll bump is needed.

Switching involves:

  1. Bumping the converter pin: gem "jekyll-sass-converter", "~> 3.0"
  2. Regenerating Gemfile.lock and adding the CI platform: bundle lock --add-platform x86_64-linux (sass-embedded is a platform-specific gem; CI runs on ubuntu-latest)
  3. Fixing one SCSS file that Dart Sass rejects (see Notes), then verifying the build

Notes

  • LibSass has been deprecated since October 2020, so this is also a move toward a supported Sass compiler.
  • Behavioral difference that requires a code fix: LibSass compiled imported .css files as Sass; Dart Sass treats .css as plain CSS. _sass/includes/brand.css uses Sass variables ($white, $black, $breakpoint-m), so Dart Sass fails with "Sass variables aren't allowed in plain CSS." Renaming it to _sass/includes/brand.scss fixes it (the @import "includes/brand" is unchanged).
  • Dart Sass also logs deprecation warnings for @import and global color functions like darken(). These do not break the build (removal is slated for Dart Sass 3.0); migrating to @use/@forward and color.adjust() is a reasonable cleanup to bundle in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions