Skip to content

Commit 1bfa6a3

Browse files
committed
[2025-10-26] Improved scss compiling
Details: - Updated API used to sass-embedded for better performance (esp. async)
1 parent 0e81dc7 commit 1bfa6a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1208
-723
lines changed

dist/js/lib/02-utils/classes/Stage_Compiler.d.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
import { DateTime } from 'luxon';
1111
import * as postcss_PresetEnv from 'postcss-preset-env';
12-
import * as sass from 'sass';
12+
import * as sass from 'sass-embedded';
1313
import type { Json, Objects } from '@maddimathon/utility-typescript/types';
1414
import type { CLI, Config, Stage } from '../../../types/index.js';
1515
import { FileSystem } from '../../00-universal/index.js';
@@ -174,7 +174,6 @@ export declare class Stage_Compiler implements Stage.Compiler {
174174
readonly sourceMap: true;
175175
readonly sourceMapIncludeSources: true;
176176
readonly style: "expanded";
177-
readonly useAsyncCompiler: false;
178177
readonly verbose: undefined;
179178
};
180179
readonly ts: {};
@@ -220,32 +219,36 @@ export declare class Stage_Compiler implements Stage.Compiler {
220219
to?: string;
221220
}[], level: number, _postCssOpts?: Stage.Compiler.Args.PostCSS): Promise<void>;
222221
/**
223-
* Creates the message for the benchmark end notice.
222+
* Logs the message for the benchmark end notice.
224223
*
225224
* @since 0.3.0-alpha.1.draft
226225
*/
227-
protected benchmarkStartTimeMaker(msg: string, start: DateTime): string;
226+
protected benchmarkEndTimeLog(msg: string, level: number, start: DateTime, end: DateTime): void;
228227
/**
229-
* Creates the message for the benchmark end notice.
228+
* Logs the message for the benchmark start notice.
230229
*
231230
* @since 0.3.0-alpha.1.draft
232231
*/
233-
protected benchmarkEndTimeMaker(msg: string, start: DateTime, end?: DateTime): string;
232+
protected benchmarkStartTimeLog(msg: string, level: number, start: DateTime): void;
234233
/**
235-
* Runs the compiler from the sass package.
234+
* Runs the compileAsync from the sass package and returns with an ending
235+
* timestamp.
236236
*
237237
* @since 0.3.0-alpha.1.draft
238238
*/
239-
protected sassCompiler(input: string, opts: Stage.Compiler.Args.Sass): Promise<{
239+
protected sassCompileAsync(input: string, opts: Stage.Compiler.Args.Sass): Promise<{
240240
compiled: sass.CompileResult;
241241
end: DateTime<true>;
242242
}>;
243243
/**
244-
* This skips compiling options and validating values.
244+
* Compiles scss via API. This skips compiling options and validating values.
245245
*
246246
* @since 0.3.0-alpha.1.draft
247247
*/
248-
protected scssAPI(input: string, output: string, level: number, sassCompleteOpts: Objects.Classify<Stage.Compiler.Args.Sass>): Promise<string>;
248+
protected scssAPI(input: string, output: string, level: number, sassCompleteOpts: Objects.Classify<Stage.Compiler.Args.Sass>, compileFn?: (input: string, opts: Stage.Compiler.Args.Sass) => Promise<{
249+
compiled: sass.CompileResult;
250+
end: DateTime;
251+
}>): Promise<string>;
249252
/**
250253
* Coverts scss args for the CLI.
251254
*
@@ -257,10 +260,10 @@ export declare class Stage_Compiler implements Stage.Compiler {
257260
*
258261
* @since 0.3.0-alpha.1.draft
259262
*/
260-
protected scssCLI(input: string, output: string, level: number, sassCompleteOpts: Objects.Classify<Stage.Compiler.Args.Sass>): Promise<{
261-
compiled: string;
262-
end: DateTime<true>;
263-
}>;
263+
protected scssCLI(input: string, output: string, level: number, sassCompleteOpts: Objects.Classify<Stage.Compiler.Args.Sass>): Promise<string>;
264+
/**
265+
* Best for CLI or single-file compiles. Otherwise use scssBulk.
266+
*/
264267
scss(input: string, output: string, level: number, sassOpts?: Stage.Compiler.Args.Sass): Promise<string>;
265268
scssBulk(paths: {
266269
input: string;

0 commit comments

Comments
 (0)