Skip to content

Commit f217058

Browse files
committed
fix(material/schematics): remove node_modules prefix from prebuilt theme
The Angular CLI supports resolving node modules without the need of specifying `node_modules` directory. This also needed to add support for Yarn PNP which doesn't create a `node_modules` directory. Closes #25242
1 parent 91bffff commit f217058

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/material/schematics/ng-add/index.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,7 @@ describe('ng-add schematic', () => {
393393

394394
describe('theme files', () => {
395395
/** Path to the default prebuilt theme file that will be added when running ng-add. */
396-
const defaultPrebuiltThemePath =
397-
'./node_modules/@angular/material/prebuilt-themes/indigo-pink.css';
396+
const defaultPrebuiltThemePath = '@angular/material/prebuilt-themes/indigo-pink.css';
398397

399398
/** Writes a specific style file to the workspace in the given tree */
400399
function writeStyleFileToWorkspace(tree: Tree, stylePath: string) {

src/material/schematics/ng-add/theming/theming.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ async function insertCustomTheme(
109109

110110
/** Insert a pre-built theme into the angular.json file. */
111111
function insertPrebuiltTheme(project: string, theme: string, logger: logging.LoggerApi): Rule {
112-
// Path needs to be always relative to the `package.json` or workspace root.
113-
const themePath = `./node_modules/@angular/material/prebuilt-themes/${theme}.css`;
112+
const themePath = `@angular/material/prebuilt-themes/${theme}.css`;
114113

115114
return chain([
116115
addThemeStyleToTarget(project, 'build', themePath, logger),

0 commit comments

Comments
 (0)