diff --git a/package.json b/package.json index 3c1bd3b..764e348 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "less-loader": "5.0.0", "mini-css-extract-plugin": "0.7.0", "npm-run-all": "4.1.5", + "optimize-css-assets-webpack-plugin": "^5.0.3", "postcss-loader": "3.0.0", "postcss-simple-vars": "5.0.2", "properties-reader": "0.0.16", diff --git a/src/less/font.less b/src/less/font.less index 832beb8..b48119e 100644 --- a/src/less/font.less +++ b/src/less/font.less @@ -1,6 +1,6 @@ -@import "../../node_modules/fineui/src/less/resource/font.less"; +@import "../../node_modules/fineui/src/less/image.less"; @import "./lib/font.less"; - +.addFontRes(); .font(dcm-link-font, @font-link); .font(dcm-info-font, @font-link-info); .font(dcm-test-font, @font-link-test); diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js index 2120e40..16cbbff 100644 --- a/webpack/webpack.dev.js +++ b/webpack/webpack.dev.js @@ -3,7 +3,7 @@ const merge = require('webpack-merge'); const path = require('path'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); - +const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const chokidar = require('chokidar'); const { execSync } = require('child_process'); @@ -65,5 +65,18 @@ module.exports = merge(common, { new HtmlWebpackPlugin({ template: path.resolve(__dirname, '../index.html'), }), + new OptimizeCssAssetsPlugin({ + assetNameRegExp: /\.css$/g, + cssProcessor: require('cssnano'), + cssProcessorPluginOptions: { + preset: ['default', { + discardComments: { + removeAll: true, + }, + normalizeUnicode: false + }] + }, + canPrint: true + }) ], }); diff --git a/webpack/webpack.prod.js b/webpack/webpack.prod.js index 4bb3786..0049917 100644 --- a/webpack/webpack.prod.js +++ b/webpack/webpack.prod.js @@ -2,7 +2,7 @@ const webpack = require('webpack'); const merge = require('webpack-merge'); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const vars = require('postcss-simple-vars'); - +const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const dirs = require('./dirs'); const common = require('./webpack.common.js'); @@ -25,6 +25,19 @@ module.exports = merge.smart(common, { }), new webpack.BannerPlugin({ banner: `time: ${new Date().toLocaleString()}` + }), + new OptimizeCssAssetsPlugin({ + assetNameRegExp: /\.css$/g, + cssProcessor: require('cssnano'), + cssProcessorPluginOptions: { + preset: ['default', { + discardComments: { + removeAll: true, + }, + normalizeUnicode: false + }] + }, + canPrint: true }) ],