Skip to content

Commit

Permalink
Bump sass-embedded requirement to ~> 1.75 and add deprecation options
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Oct 28, 2024
1 parent 1bc78c3 commit 1e9ab9e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 6 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,34 @@ 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](https://sass-lang.com/documentation/js-api/interfaces/deprecations/) 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](https://sass-lang.com/documentation/js-api/interfaces/deprecations/) 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](https://sass-lang.com/documentation/js-api/interfaces/deprecations/) for all of the
deprecations currently used by Sass.

Defaults to `[]`

## 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,7 +16,7 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 3.1"

spec.add_runtime_dependency "sass-embedded", "~> 1.54"
spec.add_runtime_dependency "sass-embedded", "~> 1.75"

spec.add_development_dependency "bundler"
spec.add_development_dependency "rake"
Expand Down
26 changes: 21 additions & 5 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,11 +175,9 @@ def convert(content)
result
rescue ::Sass::CompileError => e
Jekyll.logger.error e.full_message
if livereload? && e.respond_to?(:to_css)
e.to_css
else
raise SyntaxError, e.message
end
raise SyntaxError, e.message unless livereload?

e.to_css
end

private
Expand Down Expand Up @@ -285,6 +286,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 1e9ab9e

Please sign in to comment.