diff --git a/README.md b/README.md index 4e2b3a5..672317a 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,33 @@ Available options are: Defaults to `false`. + * **`fatal_deprecations`** + + An array of deprecations or versions to treat as fatal. + If a deprecation warning of any provided type is encountered during compilation, the compiler will error instead. + If a version is provided, then all deprecations that were active in that compiler version will be treated as fatal. + See the [Sass documentation][sass-deprecation-docs] for all of the deprecations currently used by Sass. + + Defaults to `[]` + + * **`future_deprecations`** + + An array of future deprecations to opt into early. + Future deprecations passed here will be treated as active by the compiler, emitting warnings as necessary. + See the [Sass documentation][sass-deprecation-docs] for all of the deprecations currently used by Sass. + + Defaults to `[]` + + * **`silence_deprecations`** + + An array of active deprecations to ignore. + If a deprecation warning of any provided type is encountered during compilation, the compiler will ignore it instead. + See the [Sass documentation][sass-deprecation-docs] for all of the deprecations currently used by Sass. + + Defaults to `[]` + + [sass-deprecation-docs]: https://sass-lang.com/documentation/js-api/interfaces/deprecations/ + ## Migrate from 2.x to 3.x Classic GitHub Pages experience still uses [1.x version of jekyll-sass-converter](https://pages.github.com/versions/). diff --git a/jekyll-sass-converter.gemspec b/jekyll-sass-converter.gemspec index d237e9a..cddc92d 100644 --- a/jekyll-sass-converter.gemspec +++ b/jekyll-sass-converter.gemspec @@ -16,5 +16,5 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 3.1.0" - spec.add_dependency "sass-embedded", "~> 1.54" + spec.add_dependency "sass-embedded", "~> 1.75" end diff --git a/lib/jekyll/converters/scss.rb b/lib/jekyll/converters/scss.rb index deefeab..12132a3 100644 --- a/lib/jekyll/converters/scss.rb +++ b/lib/jekyll/converters/scss.rb @@ -153,6 +153,9 @@ def sass_configs :url => sass_file_url, :quiet_deps => quiet_deps_option, :verbose => verbose_option, + :fatal_deprecations => fatal_deprecations, + :future_deprecations => future_deprecations, + :silence_deprecations => silence_deprecations, } end @@ -172,8 +175,8 @@ def convert(content) result rescue ::Sass::CompileError => e Jekyll.logger.error e.full_message - if livereload? && e.respond_to?(:to_css) - e.to_css + if livereload? + e.to_css # Render error message in browser window else raise SyntaxError, e.message end @@ -285,6 +288,21 @@ def quiet_deps_option def verbose_option !!jekyll_sass_configuration.fetch("verbose", false) end + + # Returns the value of the `fatal_deprecations`-option or '[]' by default. + def fatal_deprecations + Array(jekyll_sass_configuration["fatal_deprecations"]) + end + + # Returns the value of the `future_deprecations`-option or '[]' by default. + def future_deprecations + Array(jekyll_sass_configuration["future_deprecations"]) + end + + # Returns the value of the `silence_deprecations`-option or '[]' by default. + def silence_deprecations + Array(jekyll_sass_configuration["silence_deprecations"]) + end end end end