Webpack doesn't combine all images into single sprite
See original GitHub issueIssue Description
I use code to express my mean:
// aa.css
.a {
background: url(./img/sprites/default/table/edit-icon.png)
}
// bb.css
.b {
background: url(./img/sprites/default/table/offline-icon.png)
}
// main.js
require('aa.css');
require('bb.css'))
when I use webpack, generated a sprite : sprite.table.png
, but only offline-icon
was bundle into sprite.table.png
, the correct result should be sprite.table.png
include edit-icon.png
and offline-icon.png
both.
when use require
and run loader once and you cann’t make cache for this, so the ‘wrong’ result appear
can you solve the question ?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:18 (5 by maintainers)
Top Results From Across the Web
How to load images and spritesheets with Phaser 3 and ...
I have a Vue app with Webpack and Phaser 3 and I am trying to load images and spritesheets in my main scene....
Read more >Loading Images - SurviveJS
It's possible to generate sprite sheets out of smaller images to combine them into a single request. Webpack allows you to load images...
Read more >Make fewer HTTP requests: What this means and how to do it
CSS sprites is a technique to combine several images into a single image called a sprite sheet. Rather than downloading each image separately, ......
Read more >postcss-loader | webpack - JS.ORG
Allows to set options using config files. Options specified in the config file are combined with options passed to the loader, the loader...
Read more >Working with Images in Stylesheets with PostCSS - CSS-Tricks
We all work with images in our CSS. ... which accomplishes one of the major advantages of image sprites: combining HTTP requests. With...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I use the following webpack CSS rule:
See https://github.com/2createStudio/postcss-sprites/issues/83 for some more details about my setup as well as https://github.com/2createStudio/postcss-sprites/pull/85.
same issue+1