webpack.config.js 847 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. };