import child_process from "child_process"; import path from "path"; import {logger} from "../Logger.js"; import CopyAssetPreCompiler from "./CopyAssetPreCompiler.js"; export default class ScssAssetPreCompiler extends CopyAssetPreCompiler { public constructor( targetDir: string, publicDir: string, assetType: string, additionalFallbackAssetPaths: string[] = [], overrideTargetAssetType?: string, ) { super(targetDir, assetType, 'scss', additionalFallbackAssetPaths, false, overrideTargetAssetType); publicDir = path.join(publicDir, 'css'); this.onPreCompile(async _watch => { logger.info('Building scss assets...'); await child_process.execSync(`yarn sass ${this.actualTargetDir}:${publicDir}`, {stdio: [process.stdin, process.stdout, process.stderr]}); }); } }