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.
This commit is contained in:
Paul Gschwendtner
2018-08-31 03:21:24 +02:00
committed by Jeremy Elbourn
parent c812268ac3
commit fbee9c7d8a
2 changed files with 6 additions and 3 deletions
@@ -8,8 +8,10 @@ import { <%= classify(name) %>DataSource } from './<%= dasherize(name) %>-dataso
<%= indentTextContent(resolvedFiles.template, 4) %>
`,<% } else { %>
templateUrl: './<%= dasherize(name) %>.component.html',<% } if(inlineStyle) { %>
styles: []<% } else { %>
styleUrls: ['./<%= dasherize(name) %>.component.<%= styleext %>']<% } %><% if(!!viewEncapsulation) { %>,
styles: [`
<%= indentTextContent(resolvedFiles.stylesheet, 4) %>
`],<% } else { %>
styleUrls: ['./<%= dasherize(name) %>.component.<%= styleext %>'],<% } %><% if(!!viewEncapsulation) { %>
encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>,
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
})
+2 -1
View File
@@ -18,7 +18,8 @@ import {addModuleImportToModule, findModuleFromOptions} from '../utils/ast';
export default function(options: Schema): Rule {
return chain([
buildComponent({...options}, {
template: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html'
template: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html',
stylesheet: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.__styleext__'
}),
options.skipImport ? noop() : addTableModulesToModule(options)
]);