Как я могу использовать переменные в файле лезвия из _variables.s css? - PullRequest
0 голосов
/ 07 августа 2020

В файле resources / sass / app.s css приложения laravel 7 я могу ссылаться на переменные, определенные в resources / sass / _variables.s css как:

@import 'variables';
...
.page_content_container {
    @if ($debug_mode) {
        border: 3px dotted yellow;
    }
...

Но я не удалось сделать то же самое в блоке стилей файла лезвия:

<style>
    @import 'variables';
    
    
    .input_group_label {
        @if ($debug_mode) {
            border: 2px dotted green ;
        }
        width: 25%;
    }

Я получил ошибку:

syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF)

Как я могу это сделать?

изменено блок # 2:

Я изменил в resources / views / livewire / auth / profile.blade. php:

<style>
    @import '/resources/sass/_variables.scss';
    
    
    .input_group_label {
    
        @if ($debug_mode)
            border: 2px dotted green ;
        @endif
        width: 25%;
    
    }

    .input_group_content {
        @if ($debug_mode)
            border: 2px dotted red;
        @endif
    }

</style>

, но затем я получил ошибку:

Undefined variable: debug_mode 

debug_mode var определен в resources / sass / _variables.s css:

...

$debug_mode: false;

Что не так?

Спасибо!

1 Ответ

1 голос
/ 07 августа 2020

Вы забыли добавить @endif, используйте вот так

.input_group_label {
        @if ($debug_mode) {
            border: 2px dotted green ;
        }
    @endif
        width: 25%;
    }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...