The SCSS module compiles .scss files to CSS using Dart Sass, the primary Sass implementation. It is most commonly used through the Bundles module.
When Lunet encounters an .scss file during the build (either standalone or as part of a bundle), the SCSS module:
.css.Dart Sass is automatically downloaded on first use (version 1.94.0) and cached locally. No manual installation is required.
Note: Only
.scssfiles are compiled. The indented.sasssyntax is not currently supported by the SCSS module.
Include paths are configured in config.scriban. The scss and sass aliases both refer to the same plugin instance:
scss.includes.add "/sass/vendor"
# or equivalently:
sass.includes.add "/sass/vendor"
SCSS @use and @import directives resolve relative to the source file first, then check each additional include path. Include paths must be valid directories in the site or its extensions.
You can add include paths from downloaded resources:
with bundle
$bootstrap = resource "npm:bootstrap" "5.3.8"
scss.includes.add $bootstrap.path + "/scss"
end
The most common way to use SCSS is through a bundle in config.scriban:
with bundle
css "/css/main.scss"
concat = true
minify = true
end
The SCSS module automatically compiles the file before the bundle processes it. When minify = true, CSS minification is also performed by Dart Sass (using --style=compressed), not NUglify.
SCSS files outside of bundles are also compiled automatically. For example, css/custom.scss in your site folder will produce css/custom.css in the output.
When the Minifier module minifies CSS files, it delegates to Dart Sass (--style=compressed) rather than NUglify. This means CSS minification benefits from the same well-tested Sass engine used for compilation.
In config.scriban:
with bundle
$bootstrap = resource "npm:bootstrap" "5.3.8"
scss.includes.add $bootstrap.path + "/scss"
css "/css/main.scss"
concat = true
minify = true
end
In your css/main.scss:
@use "bootstrap/scss/bootstrap";
// Your custom styles
.my-component {
@extend .container;
}