|
| 1 | +// ----------------------------------------------------------------------------- |
| 2 | +// Dart Sass compatibility fixes for @thulite/doks-core search form styles |
| 3 | +// |
| 4 | +// Context: |
| 5 | +// When migrating from libsass to dartsass (required since Hugo v0.153.0 |
| 6 | +// deprecated libsass), Dart Sass is stricter about `@extend` rules: it |
| 7 | +// errors when the target selector does not exist in the current compilation. |
| 8 | +// |
| 9 | +// Problem: |
| 10 | +// @thulite/doks-core/assets/scss/components/_forms.scss uses `@extend` |
| 11 | +// without `!optional` on Bootstrap 4 utility classes (.form-group, |
| 12 | +// .form-inline) that were removed in Bootstrap 5. LibSass silently ignored |
| 13 | +// missing targets; Dart Sass throws a hard error: |
| 14 | +// "The target selector was not found. Use @extend <selector> !optional |
| 15 | +// to avoid this error." |
| 16 | +// |
| 17 | +// Fix: |
| 18 | +// We redeclare all affected rules here with `!optional`, so Dart Sass |
| 19 | +// skips the extend silently if the target selector is absent. |
| 20 | +// This file is imported via _custom.scss and takes precedence over the |
| 21 | +// theme's _forms.scss through Hugo's asset mount order (own assets/ last). |
| 22 | +// |
| 23 | +// Reference: |
| 24 | +// https://sass-lang.com/documentation/at-rules/extend/#optional-extends |
| 25 | +// https://gohugo.io/functions/css/sass/#dart-sass |
| 26 | +// ----------------------------------------------------------------------------- |
| 27 | + |
| 28 | +/** Search form */ |
| 29 | +.search-form { |
| 30 | + @extend .form-inline !optional; |
| 31 | +} |
| 32 | + |
| 33 | +.search-form label { |
| 34 | + @extend .form-group !optional; |
| 35 | + |
| 36 | + font-weight: normal; |
| 37 | +} |
| 38 | + |
| 39 | +.search-form .search-field { |
| 40 | + @extend .form-control !optional; |
| 41 | +} |
| 42 | + |
| 43 | +.search-form .search-submit { |
| 44 | + @extend .btn !optional; |
| 45 | + @extend .btn-secondary !optional; |
| 46 | +} |
| 47 | + |
0 commit comments