You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
847 B

4 years ago
  1. import ExtractTextPlugin from "extract-text-webpack-plugin";
  2. import OptimizeCssAssetsPlugin from "../../../src/";
  3. const notToProcess = new ExtractTextPlugin("as_is.css");
  4. const toProcess = new ExtractTextPlugin("optimize.css");
  5. module.exports = {
  6. entry: "./index",
  7. module: {
  8. rules: [
  9. {
  10. test: /as-is\.css$/,
  11. use: notToProcess.extract({
  12. fallback: { loader: "style-loader" },
  13. use: {
  14. loader: "css-loader"
  15. }
  16. })
  17. },
  18. {
  19. test: /optimize-me\.css$/,
  20. use: toProcess.extract({
  21. fallback: { loader: "style-loader" },
  22. use: {
  23. loader: "css-loader"
  24. }
  25. })
  26. }
  27. ]
  28. },
  29. plugins: [
  30. notToProcess,
  31. toProcess,
  32. new OptimizeCssAssetsPlugin({
  33. assetNameRegExp: /optimize\.css/g
  34. })
  35. ]
  36. };