Skip to content

Commit 4f12acf

Browse files
clydinhansl
authored andcommitted
fix(@schematics/angular): migrate style preprocessor options
Fixes: #10473
1 parent 1d2dd20 commit 4f12acf

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/schematics/angular/migrations/update-6/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,16 @@ function extractProjectsConfig(config: CliConfig, tree: Tree): JsonObject {
366366
buildOptions.polyfills = appRoot + '/' + app.polyfills;
367367
}
368368

369+
if (app.stylePreprocessorOptions
370+
&& app.stylePreprocessorOptions.includePaths
371+
&& Array.isArray(app.stylePreprocessorOptions.includePaths)
372+
&& app.stylePreprocessorOptions.includePaths.length > 0) {
373+
buildOptions.stylePreprocessorOptions = {
374+
includePaths: app.stylePreprocessorOptions.includePaths
375+
.map(includePath => join(app.root as Path, includePath)),
376+
};
377+
}
378+
369379
buildOptions.assets = (app.assets || []).map(_mapAssets);
370380
buildOptions.styles = (app.styles || []).map(_extraEntryMapper);
371381
buildOptions.scripts = (app.scripts || []).map(_extraEntryMapper);

packages/schematics/angular/migrations/update-6/index_spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ describe('Migration to v6', () => {
5050
styles: [
5151
'styles.css',
5252
],
53+
stylePreprocessorOptions: {
54+
includePaths: [
55+
'styleInc',
56+
],
57+
},
5358
scripts: [],
5459
environmentSource: 'environments/environment.ts',
5560
environments: {
@@ -506,6 +511,7 @@ describe('Migration to v6', () => {
506511
expect(build.builder).toEqual('@angular-devkit/build-angular:browser');
507512
expect(build.options.scripts).toEqual([]);
508513
expect(build.options.styles).toEqual(['src/styles.css']);
514+
expect(build.options.stylePreprocessorOptions).toEqual({includePaths: ['src/styleInc']});
509515
expect(build.options.assets).toEqual([
510516
{ glob: '**/*', input: 'src/assets', output: '/assets' },
511517
{ glob: 'favicon.ico', input: 'src', output: '/' },

0 commit comments

Comments
 (0)