Skip to content
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

Images not getting compressed #2935

Closed
a5hik opened this issue Oct 28, 2016 · 9 comments
Closed

Images not getting compressed #2935

a5hik opened this issue Oct 28, 2016 · 9 comments
Labels
area: @angular-devkit/build-angular feature Issue that requests a new feature

Comments

@a5hik
Copy link

a5hik commented Oct 28, 2016

angular-cli: 1.0.0-beta.18 node: 6.2.1 os: darwin x64

I do have a .png file in assets folder, and I refer in my CSS as background: url(/../../assets/images/Logo_3d.png) no-repeat; as an inline style.

and my webpack output show no png package chunk, So I guess it would be bundled as part of styles chunk.

Asset Size Chunks Chunk Names inline.js 1.47 kB 3 [emitted] inline 674f50d287a8c48dc19ba404d20fe713.eot 166 kB [emitted] b06871f281fee6b241d60582ae9369b9.ttf 166 kB [emitted] fee66e712a8a08eef5805a46892932ad.woff 98 kB [emitted] af7ae505a9eed503f8b8e6982036873e.woff2 77.2 kB [emitted] main.0b7da689dc574a32e9bf.bundle.js 2.91 MB 0, 3 [emitted] main styles.773d32919e284cc33328.bundle.js 284 kB 1, 3 [emitted] styles scripts.85878e10a4d6158213d7.bundle.js 10.2 kB 2, 3 [emitted] scripts 912ec66d7572ff821749319396470bde.svg 444 kB [emitted] main.0b7da689dc574a32e9bf.bundle.map 18.7 MB 0, 3 [emitted] main styles.773d32919e284cc33328.bundle.map 622 kB 1, 3 [emitted] styles scripts.85878e10a4d6158213d7.bundle.map 23.3 kB 2, 3 [emitted] scripts inline.d41d8cd98f00b204e980.bundle.map 13.5 kB 3 [emitted] inline styles.773d32919e284cc33328.bundle.js.gz 40.5 kB [emitted] main.0b7da689dc574a32e9bf.bundle.js.gz 663 kB [emitted] index.html 615 bytes [emitted]

But when I access my site by running in prod mode. ng serve --prod I still see the image rendered in original size of 420kb.

Doesn't the webpack take care of image compression? May be is this Intentional?

@deebloo
Copy link
Contributor

deebloo commented Oct 31, 2016

I don't believe the cli handles optimizing images for you

@filipesilva filipesilva added type: enhancement P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels Nov 3, 2016
@filipesilva
Copy link
Contributor

filipesilva commented Nov 3, 2016

We do not optimize images currently, no. Anything copied over via the assets array isn't preprocessed, just copied.

@a5hik
Copy link
Author

a5hik commented Nov 8, 2016

But then what these chunks are all about?

912ec66d7572ff821749319396470bde.svg 444 kB [emitted]
b06871f281fee6b241d60582ae9369b9.ttf 166 kB [emitted] fee66e712a8a08eef5805a46892932ad.woff 98 kB [emitted] af7ae505a9eed503f8b8e6982036873e.woff2 77.2 kB [emitted]

@filipesilva
Copy link
Contributor

Those are from stuff referenced in the styles array or stylesUrl in components.

@xtreemrage
Copy link

Would love to have my images compressed with a production build

@anodal88
Copy link

anodal88 commented Aug 4, 2017

@filipesilva i want to ask you something about angular-cli, I am new with angular-cli and i remember when i was working with angular2+systemjs that i could load programmatically some modules lazy with something like this:
import { SystemJsNgModuleLoader, NgModuleFactory } from '@angular/core';

constructor(private loader: SystemJsNgModuleLoader) { }
//inside of ngOnInit
this.loader.load('app/Components/x/x.module#XModule').then((factory: NgModuleFactory) => {
console.log(factory);
});

Do you know if there is a method to do something similar with angular-cli ?

Sorry for the question in this post but i don't know where is the proper place to post my question, thanks in advance.

@filipesilva
Copy link
Contributor

@anodal88 not quite, but there's a high-level discussion issue about it in #4541.

@hansl hansl added the feature Issue that requests a new feature label Jan 30, 2018
@filipesilva filipesilva removed the P5 The team acknowledges the request but does not plan to address it, it remains open for discussion label Feb 1, 2018
@clydin
Copy link
Member

clydin commented Sep 28, 2018

Closing as decisions about image compression/optimization are extremely project specific and there are a veritable cornucopia of tools available to do so based on the specific needs of the project.

@clydin clydin closed this as completed Sep 28, 2018
@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
area: @angular-devkit/build-angular feature Issue that requests a new feature
Projects
None yet
Development

No branches or pull requests

8 participants