Skip to content

Commit 05829d5

Browse files
alexfriesendevversion
authored andcommitted
build: import sass
1 parent 6bfbe9b commit 05829d5

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

tools/sass/compiler-main.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ import * as worker from '@bazel/worker';
22
import * as fs from 'fs';
33
import * as path from 'path';
44
import yargs from 'yargs';
5+
import {OutputStyle, compile} from 'sass';
56

67
import {createLocalAngularPackageImporter} from './local-sass-importer';
78

8-
// TODO: Switch to normal import when https://github.com/sass/dart-sass/issues/1714 is fixed.
9-
// Also re-add the `as XX` type narrowing below.
10-
const sass = require('sass') as any;
11-
129
const workerArgs = process.argv.slice(2);
1310

1411
// Note: This path is relative to the current working directory as build actions
@@ -63,8 +60,8 @@ async function processBuildAction(args: string[]) {
6360
.option('style', {type: 'string'})
6461
.parseAsync();
6562

66-
const result = sass.compile(inputExecpath, {
67-
style: style, // TODO: Re-add: as sass.OutputStyle,
63+
const result = compile(inputExecpath, {
64+
style: style as OutputStyle,
6865
sourceMap,
6966
sourceMapIncludeSources: embedSources,
7067
loadPaths: loadPath,

tools/sass/local-sass-importer.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import {pathToFileURL} from 'url';
22
import {join} from 'path';
3-
4-
// TODO: Add explicit type for `Sass.FileImporter` once
5-
// https://github.com/sass/dart-sass/issues/1714 is fixed.
3+
import {FileImporter} from 'sass';
64

75
/** Prefix indicating Angular-owned Sass imports. */
86
const angularPrefix = '@angular/';
@@ -11,7 +9,7 @@ const angularPrefix = '@angular/';
119
* Creates a Sass `FileImporter` that resolves `@angular/<..>` packages to the
1210
* specified local packages directory.
1311
*/
14-
export function createLocalAngularPackageImporter(packageDirAbsPath: string) {
12+
export function createLocalAngularPackageImporter(packageDirAbsPath: string): FileImporter {
1513
return {
1614
findFileUrl: (url: string) => {
1715
if (url.startsWith(angularPrefix)) {

0 commit comments

Comments
 (0)