atlas-guide icon indicating copy to clipboard operation
atlas-guide copied to clipboard

Build will fail if some of scss files with variables have `@use`

Open nfxpnk opened this issue 1 year ago • 0 comments

STR: Add @use 'sass:color'; to _colors.scss and try to build styleguide

Result:

Warn: Atlas: Could not compile configuration file. Styleguide page and consistency checks could not be prepared.
Ensure that "scssAdditionalImportsArray" has all additional imports paths.
 Error: @use rules must be written before any other rules.
   ╷
71 │ @use 'sass:color';
   │ ^^^^^^^^^^^^^^^^^
   ╵
  stdin 71:1  root stylesheet

file models\projectconstants.js combined scss for mustache has an error

function compileStyles(constantsData, additionalSassImports) {
    const template = '{{>constantsFile}} {{#constants}} {{constNameSafe}} { color: {{constName}} } {{/constants}}';
    let cssString = '';

    try {
        const styles = sass.renderSync({
            data: mustache.render(
                template,
                {constants: constantsData.rawConstants},
                {constantsFile: constantsData.fileString}),
            includePaths: additionalSassImports
        });
        cssString = styles.css.toString();
    } catch (error) {
        console.log('Warn: Atlas: Could not compile configuration file. ' +
            'Styleguide page and consistency checks could not be prepared.\n' +
            'Ensure that "scssAdditionalImportsArray" has all additional imports paths.\n', error.formatted);
    }

    return cssString;
}

nfxpnk avatar Jan 15 '23 22:01 nfxpnk