$ show shakacode/sass-resources-loader
sass-resources-loader is a Webpack loader that automatically injects Sass resources (variables, mixins, functions) into every Sass module processed by Webpack. It eliminates the need to manually import shared Sass utilities in each file by preprocessing Sass source files to prepend resource content. The loader supports both @import and @use Sass syntax, includes special handling for hoisting @use statements (which must precede other declarations), and correctly rewrites relative paths in imports to be relative to the webpack context. It handles glob patterns for resource files and provides detailed error reporting.
The LLM identified 3 files worth highlighting for reuse:
Self-contained utility for expanding glob patterns to file paths with descriptive error handling. Handles both string and array inputs, uses glob.sync internally, and provides clear error messages when no files match patterns. Demonstrates good input validation and error reporting practices.
Specialized utility for rewriting @import and @use paths in Sass files to be relative to the webpack context. Includes domain-specific logic to skip rewriting of Sass built-in paths (sass:*) and converts path separators to Unix style. Shows deep understanding of both Webpack loader mechanics and Sass specifics.
Contains the core logic for injecting Sass resources into source files. Handles the complex case of hoisting @use statements (which must precede other declarations in Sass) with automatic deduplication. Demonstrates advanced understanding of Sass semantics within the constraints of a Webpack loader.