UNPKG

webpack-genius

Version:

**For chinese developers:** you'd better add taobao mirror before everything start. Or you may fail to install. ```bash yarn config set registry http://registry.npm.taobao.org ```

41 lines (40 loc) 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MiniCss = void 0; var tslib_1 = require("tslib"); var mini_css_extract_plugin_1 = tslib_1.__importDefault(require("mini-css-extract-plugin")); var optimize_css_assets_webpack_plugin_1 = tslib_1.__importDefault(require("optimize-css-assets-webpack-plugin")); var PluginHandle_1 = require("./PluginHandle"); // https://github.com/webpack-contrib/mini-css-extract-plugin#extracting-all-css-in-a-single-file var MiniCss = /** @class */ (function (_super) { tslib_1.__extends(MiniCss, _super); function MiniCss() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.config = { filename: "styles/[name]." + _this.genius.switchContentHash() + ".css", chunkFilename: "styles/chunk." + _this.genius.switchContentHash() + ".css", ignoreOrder: true, }; return _this; } MiniCss.prototype.setFilename = function (name) { this.config.filename = name; return this; }; MiniCss.prototype.setChunkFilename = function (name) { this.config.chunkFilename = name; return this; }; MiniCss.prototype.setIgnoreOrder = function (ignore) { this.config.ignoreOrder = ignore; return this; }; MiniCss.prototype.collect = function () { return [ new mini_css_extract_plugin_1.default(this.config), new optimize_css_assets_webpack_plugin_1.default(), ]; }; return MiniCss; }(PluginHandle_1.PluginHandle)); exports.MiniCss = MiniCss;