Skip to content

Commit

Permalink
Move to scss @use from @import where possible (#564)
Browse files Browse the repository at this point in the history
Closes #488
  • Loading branch information
eoinkelly authored Sep 5, 2024
1 parent 086c9df commit ea1dc8e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// The entry point for all SCSS
@import "reset";
@import "elements";
@use "reset";
@use "elements";
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
// `$body-color` or write more CSS that override's Bootstrap's CSS like so:
// `body { color: red; }`.

// We use @import because Bootstrap will not support @use until v6. See
// https://github.com/twbs/bootstrap/issues/30025#issuecomment-574825600

@import "bootstrap/scss/functions"; // required
@import "bootstrap/scss/mixins"; // required

Expand Down
10 changes: 8 additions & 2 deletions variants/frontend-bootstrap/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
insert_into_file "app/frontend/packs/application.js", "import '../js/bootstrap';", before: 'import "../stylesheets/application.scss";'

copy_file "app/frontend/stylesheets/customized_bootstrap.scss", force: true
prepend_to_file "app/frontend/stylesheets/application.scss" do
append_to_file "app/frontend/stylesheets/application.scss" do
<<~EO_CONTENT
@import "../stylesheets/customized_bootstrap";
// We use @import because Bootstrap will not support @use until v6. See
// https://github.com/twbs/bootstrap/issues/30025#issuecomment-574825600 Our own
// SCSS files should use @use. Webpack requires that all `@use` be first in a
// file which conflicts with the stylelint no-invalid-position-at-import-rule`
// rule so we disable it for this line.
@import "../stylesheets/customized_bootstrap"; // stylelint-disable-line no-invalid-position-at-import-rule -- See above
EO_CONTENT
end

Expand Down

0 comments on commit ea1dc8e

Please sign in to comment.