Among the many awesome things in the Angular CLI is the ability to lazy load a CSS file. My problem is that the documentation doesn't specify how to load it once you create it. When you run the build, the file that gets created for your css has a hash in the name, like foo.asdf908a7sd0as7g.bundle.css. Because the name of the production file isn't a static name, I can't figure out how to lazy load it. If there is a known way to do this, please show me, and I will help out and PR the docs.
x)- [ ] bug report -> please search issues before submitting
- [X] feature request
- [ maybe ] devkit
- [ ] schematics
- [ X ] documentation
Angular CLI: 1.7.4
Node: 9.5.0
OS: darwin x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cdk: 5.2.5
@angular/cli: 1.7.4
@angular/material: 2.0.0-beta.12
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.4.9
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.6.2
webpack: 3.11.0
foo.css."styles":[
...
{"input": "foo.css", "lazy": true}
]
There is no log, cause there is no failure.
I would love to see a way to lazily load these css files.
In a separate issue @filipesilva acknowledges that while a way to create lazily loaded css files exists, there is no provided way to load these created files. We need to get a way to allow people to load these created css files. In that issue, the participants are using native webpack functionality to load these css files. I don't want to use Webpack directly, because that will make it harder for me to upgrade my CLI one day when it switches to Bazel.
Having the same issue, an example will be helpful!
Heya I was looking into this today and think I have a solution in https://github.com/angular/angular-cli/pull/11491.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Heya I was looking into this today and think I have a solution in https://github.com/angular/angular-cli/pull/11491.