Skip to content
This repository was archived by the owner on Aug 10, 2021. It is now read-only.

Add image-sprite-webpack-plugin - #103

Open
hwshim wants to merge 1 commit into
webpack-contrib:masterfrom
hwshim:add-image-sprite-webpack-plugin
Open

Add image-sprite-webpack-plugin#103
hwshim wants to merge 1 commit into
webpack-contrib:masterfrom
hwshim:add-image-sprite-webpack-plugin

Conversation

@hwshim

@hwshim hwshim commented May 10, 2018

Copy link
Copy Markdown

image-sprite-webpack-plugin generates bitmap-image based spritesheets from your stylesheets.

Input

h1.logo {
    width: 240px;
    height: 80px;
    background: url(./img/logo.png) no-repeat 0 0;
}

span.itemPicture {
    display: inline-block;
    background-image: url(./img/item-picture.png);
    background-repeat: no-repeat;
    background-position: 0 0;
    width: 36px;
    height: 36px;
}

Output

h1.logo {
  width: 240px;
  height: 80px;
  background: url(/css/sprite.png) no-repeat 0 -20px;
  /* background: url(/img/logo.png) no-repeat 0 0 */
}

span.itemPicture {
  display: inline-block;
  background-image: url(/css/sprite.png);
  /* background-image: url(/img/item-picture.png) */
  background-repeat: no-repeat;
  background-position: -100px -90px;
  /* background-position: 0 0 */
  width: 36px;
  height: 36px;
}

Features

  • Simple and easy to use.
  • Supports bitmap images (png, jpg, gif, but not svg)
  • Provides comments contains original image url to help with debugging.
  • Supports Hot Module Reload.
  • Supports webpack 2.x ~ 4.x. (see examples)
  • Works fine along with cooperative plugins (mini-css-extract, extract-text-webpack).
  • Requires css-loader to handle CssModule.

@alexander-akait

Copy link
Copy Markdown
Member

@hwshim please rebase

Generates bitmap image spritesheets from your stylesheets.

https://github.com/naver/image-sprite-webpack-plugin

* Simple and easy to use.
* Supports bitmap images (png, jpg, gif, not svg)
* Supports HMR.
* Supports webpack 2.x ~ 4.x.
* Works fine with cooperative plugins (extract-text-webpack, mini-css-extract).
* Requires css-loader to handle CssModule.
@hwshim
hwshim force-pushed the add-image-sprite-webpack-plugin branch from aa4cf93 to f1327cd Compare June 11, 2018 05:04
@hwshim

hwshim commented Jun 11, 2018

Copy link
Copy Markdown
Author

@evilebottnawi

Rebase complete. Thank you.

@alexander-akait alexander-akait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need tests in source repo, thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants