Skip to content

Unload bundle styles, loaded by lazy load global styles #12727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yamaoto opened this issue Oct 24, 2018 · 2 comments
Closed

Unload bundle styles, loaded by lazy load global styles #12727

yamaoto opened this issue Oct 24, 2018 · 2 comments

Comments

@yamaoto
Copy link

yamaoto commented Oct 24, 2018

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Versions

Windows (7/8/10).

$ node --version
v8.11.1
npm --version
5.6.0
ng --version

     _                      _                 ____ _     ___    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | | /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|                |___/

Angular CLI: 7.0.2Node: 8.11.1OS: win32 x64
Angular: 7.0.0... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.10.2
@angular-devkit/build-angular     0.10.2
@angular-devkit/build-optimizer   0.10.2
@angular-devkit/build-webpack     0.10.2
@angular-devkit/core              7.0.2
@angular-devkit/schematics        7.0.2
@angular/cdk                      7.0.1
@angular/cli                      7.0.2
@angular/material                 7.0.1
@ngtools/webpack                  7.0.2
@schematics/angular               7.0.2
@schematics/update                0.10.2
rxjs                              6.3.3
typescript                        3.1.3
webpack                           4.19.1

Repro steps

  1. ng new
  2. add lazy load module
  3. add lazy load global style like this How to lazy load global style? #5880 in component
  4. here. unload styles in ngOnDestroy <-- feature request

Desired functionality

Unload bundle styles, loaded by lazy load global styles.
For example we can set unique id on style element in DOM, and if you want, unload it by bundle name or unique id.

It may be helpful in case: lazy load module have global style imports from css libraries (bundled from node_modules), but if you will navigate to another route with another module --> styles from first can conflict with second

@alan-agius4
Copy link
Collaborator

For lazy styles, it is your responsibility to add and remove them from the DOM. Similar to how you are doing the load, you need to implement an unload

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants