samedi 13 février 2021

Dynamic import style and set scss variable value

I have an admin template in which I would like user to provide option to switch between different theme color such as dark/light theme along with setting variable values, but I'm unable to conditionally import style files.

@if $light-theme {
    @import "./_metronic/_assets/sass/themes/layout/aside/light.scss";
    $primary: green;
} @else {
    @import "./_metronic/_assets/sass/themes/layout/aside/dark.scss";
    $primary: blue;
}

Getting error: Import directives may not be used within control directives or mixins.

Aucun commentaire:

Enregistrer un commentaire