Skip to content

Commit

Permalink
Add support to configure more deprecation warnings from Dart Sass (#164)
Browse files Browse the repository at this point in the history
Merge pull request 164
  • Loading branch information
ntkme authored Oct 30, 2024
1 parent 146a947 commit 45330f6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand Down
2 changes: 1 addition & 1 deletion jekyll-sass-converter.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 20 additions & 2 deletions lib/jekyll/converters/scss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 45330f6

Please sign in to comment.