1
0
mirror of https://github.com/locomotivemtl/locomotive-boilerplate.git synced 2026-01-15 00:55:08 +08:00

Upgrade sass package to v1.79 (#183)

* Update sass to v1.79

* Fix broken node_modules import

* Fix conflict with new sass color() function

color() -> colorCode()

* build:styles - Remove deprecated sass.render()

* build:styles - remove infile + outfile from sass.compile options
This commit is contained in:
Michel Descoteaux
2024-10-16 10:07:10 -04:00
committed by GitHub
parent d593fe5409
commit 1ec1229fe4
8 changed files with 507 additions and 33 deletions

View File

@@ -10,12 +10,9 @@ import resolve from '../helpers/template.js';
import { merge } from '../utils/index.js';
import { writeFile } from 'node:fs/promises';
import { basename } from 'node:path';
import { promisify } from 'node:util';
import * as sass from 'sass';
import { PurgeCSS } from 'purgecss';
const sassRender = promisify(sass.render);
let postcssProcessor;
/**
@@ -24,16 +21,15 @@ let postcssProcessor;
* @const {object} productionSassOptions - The predefined Sass options for production.
*/
export const defaultSassOptions = {
omitSourceMapUrl: true,
sourceMapIncludeSources: true,
sourceMap: true,
sourceMapContents: true,
};
export const developmentSassOptions = Object.assign({}, defaultSassOptions, {
outputStyle: 'expanded',
style: 'expanded',
});
export const productionSassOptions = Object.assign({}, defaultSassOptions, {
outputStyle: 'compressed',
style: 'compressed',
});
/**
@@ -127,10 +123,7 @@ export default async function compileStyles(sassOptions = null, postcssOptions =
infile = resolve(infile);
outfile = resolve(outfile);
let result = await sassRender(Object.assign({}, sassOptions, {
file: infile,
outFile: outfile,
}));
let result = sass.compile(infile, sassOptions);
if (supportsPostCSS && postcssOptions) {
if (typeof postcssProcessor === 'undefined') {