diff --git a/package.json b/package.json index f09ec9a..f6efbfe 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "yarn": "^1.21.1" }, "devDependencies": { + "@a2nt/image-sprite-webpack-plugin": "^0.2.5", "autoprefixer": "^7.2.5", "babel-core": "^6.26.3", "babel-eslint": "^8.2.6", diff --git a/webpack.config.js b/webpack.config.js index a3eeebe..91eb54f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -12,6 +12,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin'); const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const ImageminPlugin = require('imagemin-webpack'); +const ImageSpritePlugin = require('@a2nt/image-sprite-webpack-plugin'); const plugins = [ new webpack.DefinePlugin({ @@ -89,6 +90,20 @@ if (COMPRESS) { }, }), ); + + plugins.push( + new ImageSpritePlugin({ + exclude: /exclude|original|default-|icons|sprite/, + commentOrigin: false, + compress: true, + extensions: ['png'], + indent: '', + log: true, + //outputPath: path.join(__dirname, conf.APPDIR, conf.DIST), + outputFilename: 'img/sprite-[hash].png', + padding: 0, + }), + ); } const includes = {};