I'd like to get the CSS file content of a component.
For example:
hello-world.component.ts:
@Component({
selector: 'app-hello-world',
template: `<h1>Hello World</h1>`,
styleUrls: ['./hello-world.component.css']
})
export class HelloWorldComponent {
getCSSContent(){
}
}
hello-world.component.css:
h1 {
color: red;
font-weight: 400;
}
I expect getCSSContent function to return:
h1 {
color: red;
font-weight: 400;
}
this.http.get('./app.component.css').subscribe(data => { console.log('data', data); })(http request with httpClient)<script>tag created by Angular. What I did, was to make a copy of the CSS file to my/assets/folder and read it from there.