Symfony encore, variables in sass and scss

Viewed 259

I have a variable file in scss and import it with Symfony encore for my scss and sass files (see the code below).

// enables Sass/SCSS support
Encore.enableSassLoader((options) => {
    options.implementation = require('sass')
    options.additionalData = `@import "@/scss/variables.scss"`
});

The problem is there are sass (node-module(s)) and scss (template) files in my project which needs them. If I run it like the snippet above it went fine for the sass files, but the scss files give an error: 'SassError: expected ";" after the @import line in the additionalData'.

However if I add the ; after the import line I get an error from the sass files 'SassError: semicolons aren't allowed in the indented syntax.'.

It's probably a small issue which I miss but I have no clue at the moment. I tried it with the added parameter indentedSyntax with true and false in the sassOptions but this was no success.

Anyone have an idea?

With kind regards

0 Answers
Related