2createStudio / postcss-sprites

Generate sprites from stylesheets.
MIT License
413 stars 50 forks source link

http2 AggressiveSplitting #88

Open graingert opened 7 years ago

graingert commented 7 years ago

Similar to the webpack AggressiveSplittingPlugin https://medium.com/webpack/webpack-http-2-7083ec3f3ce6

Automatically split all the spritesheets into smaller sheets: This improves the caching while worsens the compression (and transferring for HTTP/1).

When the application is updated try hard to reuse the previously created sheets. Therefore every time the AggressiveSplittingPlugin finds a good chunk (size within the limits), it stores the sheets' images and hash into a records file.

Records is webpack’s concept of state that is kept between compilations. It’s stored to and read from a JSON file. postcss-sprites will have to recreate something likey this.

When the AggressiveSplittingPlugin is called again it first must restore the sprite sheet chunks from records before trying to split the remaining modules. This ensures that cached chunks are reused.