You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the src/swiper.scss file features following line of code:
@use'swiper-vars.scss'asvars;
This is so the variables inside src/swiper-vars.scss (which is only $themeColor at the time of writing) is included into the namespace of vars.
This included variable is used once in src/core/core.scss via vars.$themeColor.
However, as a developer using swiper, this now complicates overwriting said variable in my own code.
There is no way of overwriting $themeColor for example by:
@use"~swiper/scss"with (
$themeColor: /* some value */,
);
because the variable cannot be overwritten through two levels of @use.
This will generally hold true for any variable that might be added to the file in the future.
Clear and concise description of the problem
Currently, the
src/swiper.scss
file features following line of code:This is so the variables inside
src/swiper-vars.scss
(which is only$themeColor
at the time of writing) is included into the namespace ofvars
.This included variable is used once in
src/core/core.scss
viavars.$themeColor
.However, as a developer using swiper, this now complicates overwriting said variable in my own code.
There is no way of overwriting
$themeColor
for example by:because the variable cannot be overwritten through two levels of
@use
.This will generally hold true for any variable that might be added to the file in the future.
Suggested solution
In the
src/copy/package.json
we could export thesrc/swiper-vars.scss
file to./scss/vars
, for example:{ /* ... */ "exports": { /* ... */ "./scss/thumbs": "./modules/thumbs.scss", + "./scss/vars": "./swiper-vars.scss", "./scss/virtual": "./modules/virtual.scss", /* ... */ }, }
This would allow for following code to work:
Alternative
There is an alternative to use
@import
instead of@use
as was the case in older versions of Swiper, but this is not recommended since the use of the old@import
is meant to be replaced by@use
(see also https://sass-lang.com/documentation/at-rules/use/#differences-from-import).Additional context
No response
Validations
Would you like to open a PR for this feature?
The text was updated successfully, but these errors were encountered: