Skip to content

Commit fbee9c7

Browse files
devversionjelbourn
authored andcommitted
refactor(schematics): table schematic not inlining style file (#12905)
This is not a bug fix because the styleext file is basically empty. But in case we add styles to the styleext template file, we should automatically properly inline the styles if `--inlineStyle` is specified.
1 parent c812268 commit fbee9c7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/lib/schematics/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ import { <%= classify(name) %>DataSource } from './<%= dasherize(name) %>-dataso
88
<%= indentTextContent(resolvedFiles.template, 4) %>
99
`,<% } else { %>
1010
templateUrl: './<%= dasherize(name) %>.component.html',<% } if(inlineStyle) { %>
11-
styles: []<% } else { %>
12-
styleUrls: ['./<%= dasherize(name) %>.component.<%= styleext %>']<% } %><% if(!!viewEncapsulation) { %>,
11+
styles: [`
12+
<%= indentTextContent(resolvedFiles.stylesheet, 4) %>
13+
`],<% } else { %>
14+
styleUrls: ['./<%= dasherize(name) %>.component.<%= styleext %>'],<% } %><% if(!!viewEncapsulation) { %>
1315
encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>,
1416
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
1517
})

src/lib/schematics/table/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import {addModuleImportToModule, findModuleFromOptions} from '../utils/ast';
1818
export default function(options: Schema): Rule {
1919
return chain([
2020
buildComponent({...options}, {
21-
template: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html'
21+
template: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html',
22+
stylesheet: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.__styleext__'
2223
}),
2324
options.skipImport ? noop() : addTableModulesToModule(options)
2425
]);

0 commit comments

Comments
 (0)