Skip to content

Commit 9d71ebf

Browse files
alan-agius4clydin
authored andcommitted
refactor(@angular-devkit/build-angular): clean up style include paths logic
1 parent 7972ec7 commit 9d71ebf

File tree

1 file changed

+2
-16
lines changed
  • packages/angular_devkit/build_angular/src/webpack/configs

1 file changed

+2
-16
lines changed

packages/angular_devkit/build_angular/src/webpack/configs/styles.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,7 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
3838
const hashFormat = getOutputHashFormat(buildOptions.outputHashing as string);
3939

4040
// use includePaths from appConfig
41-
const includePaths: string[] = [];
42-
let lessPathOptions: { paths?: string[] } = {};
43-
44-
if (
45-
buildOptions.stylePreprocessorOptions &&
46-
buildOptions.stylePreprocessorOptions.includePaths &&
47-
buildOptions.stylePreprocessorOptions.includePaths.length > 0
48-
) {
49-
buildOptions.stylePreprocessorOptions.includePaths.forEach((includePath: string) =>
50-
includePaths.push(path.resolve(root, includePath)),
51-
);
52-
lessPathOptions = {
53-
paths: includePaths,
54-
};
55-
}
41+
const includePaths = buildOptions.stylePreprocessorOptions?.includePaths?.map(p => path.resolve(root, p)) ?? [];
5642

5743
// Process global styles.
5844
if (buildOptions.styles.length > 0) {
@@ -138,7 +124,7 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
138124
sourceMap: cssSourceMap,
139125
lessOptions: {
140126
javascriptEnabled: true,
141-
...lessPathOptions,
127+
paths: includePaths,
142128
},
143129
},
144130
},

0 commit comments

Comments
 (0)