Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

Commit

Permalink
fix(@schematics/angular): migrate style preprocessor options
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin authored and hansl committed Apr 27, 2018
1 parent 1d2dd20 commit 4f12acf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/schematics/angular/migrations/update-6/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,16 @@ function extractProjectsConfig(config: CliConfig, tree: Tree): JsonObject {
buildOptions.polyfills = appRoot + '/' + app.polyfills;
}

if (app.stylePreprocessorOptions
&& app.stylePreprocessorOptions.includePaths
&& Array.isArray(app.stylePreprocessorOptions.includePaths)
&& app.stylePreprocessorOptions.includePaths.length > 0) {
buildOptions.stylePreprocessorOptions = {
includePaths: app.stylePreprocessorOptions.includePaths
.map(includePath => join(app.root as Path, includePath)),
};
}

buildOptions.assets = (app.assets || []).map(_mapAssets);
buildOptions.styles = (app.styles || []).map(_extraEntryMapper);
buildOptions.scripts = (app.scripts || []).map(_extraEntryMapper);
Expand Down
6 changes: 6 additions & 0 deletions packages/schematics/angular/migrations/update-6/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ describe('Migration to v6', () => {
styles: [
'styles.css',
],
stylePreprocessorOptions: {
includePaths: [
'styleInc',
],
},
scripts: [],
environmentSource: 'environments/environment.ts',
environments: {
Expand Down Expand Up @@ -506,6 +511,7 @@ describe('Migration to v6', () => {
expect(build.builder).toEqual('@angular-devkit/build-angular:browser');
expect(build.options.scripts).toEqual([]);
expect(build.options.styles).toEqual(['src/styles.css']);
expect(build.options.stylePreprocessorOptions).toEqual({includePaths: ['src/styleInc']});
expect(build.options.assets).toEqual([
{ glob: '**/*', input: 'src/assets', output: '/assets' },
{ glob: 'favicon.ico', input: 'src', output: '/' },
Expand Down

0 comments on commit 4f12acf

Please sign in to comment.