webpack.config.sprites.js 756 B

12345678910111213141516171819202122232425262728
  1. const path = require('path');
  2. const paths = require('./paths');
  3. const SpritesmithPlugin = require('webpack-spritesmith');
  4. module.exports = {
  5. mode: 'development',
  6. entry: {
  7. app: ['webpack-dev-server/client?http://0.0.0.0:3000', 'webpack/hot/only-dev-server'],
  8. },
  9. plugins: [
  10. new SpritesmithPlugin({
  11. src: {
  12. cwd: path.resolve(paths.appSrc, 'styles/sprites/model-card'),
  13. glob: '*.png',
  14. },
  15. target: {
  16. image: path.resolve(paths.appBuild, 'sprites/model-card-bg.png'),
  17. css: path.resolve(paths.appBuild, 'sprites/model-card-bg.css'),
  18. },
  19. apiOptions: {
  20. cssImageRef: './model-card-bg.png',
  21. },
  22. spritesmithOptions: {
  23. algorithm: 'top-down',
  24. },
  25. }),
  26. ],
  27. };