-
Notifications
You must be signed in to change notification settings - Fork 53
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 optimized when inlined with url-loader #22
Comments
I didn't even think about inlined images! I'll take a look at this. It should be fairly easy, but it's going to require some special handling. Would you be able to point me to a repo that uses both this plugin and url-loader in this way that I can test on? It's no big deal if you can't, but it would speed things up a bit. |
I don't but this can be added to one of your own builds:
|
Ugh, this is gonna be a lot harder than it looked. url-loader doesn't add anything to the assets array when it inlines an image. So they never even reach this plugin to have me test or anything to them. I'm still looking into if there are any options here, but it's not looking good... Just kind of "thinking out loud here":
Let me know if you have any thoughts on the above options. I'm going to look into url-loader's code and see if there is anything there that can help. I'm loving option 1 the most, if it would work. |
Okay, after looking into a few things, I think i've got an idea here. I might be able to add my own "loader" to the pipeline using the I'm not sure if im abusing the hell out of the webpack pipeline here or not, but either way I'm gonna walk away from this for a while and think about it and play with some stuff. Sorry, but don't expect this to be added today. |
Have that done? I met the same problem. 😄 |
I'm going to be giving up on this for the forseeable future. I'll leave the issue open, and if anyone comes along that is able to implement something to help solve this i'd be more than happy to work with them, but I just don't have the time to rewrite such a large part of this plugin to do a multi-pass optimization like that. I recently added the option to optimize images only over a specific size, so as a "hacky" fix you can set this plugin to only apply to images over a given size, then use It's not ideal, but I just won't be able to realistically implement this correctly any time soon. |
When images get inlined by url loader they do not get minimized. With the image-webpack-loader they do get minified inline. Should have it inlined under 10KB atleast
Stats:
original: 37KB
not inline with imagemin-webpack-plugin: 5.7KB
inline with imagemin-webpack-plugin and url-loader: 37KB
inline with url-loader + image-webpack-loader: 6.4KB
The text was updated successfully, but these errors were encountered: