UNPKG

@zohodesk/client_build_tool

Version:

A CLI tool to build web applications and client libraries

30 lines (26 loc) 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getAllowedPostCssPlugins = getAllowedPostCssPlugins; exports.postcssPluginGetter = postcssPluginGetter; var _filterPluginsAllowedForSpecficFile = require("./filterPluginsAllowedForSpecficFile"); function getAllowedPostCssPlugins(filename, enabledPlugins, enabledCustomPlugins) { const neededPostCssPlugins = (0, _filterPluginsAllowedForSpecficFile.filterPluginsAllowedForSpecificFile)(enabledPlugins, filename); const neededCustomPlugins = (0, _filterPluginsAllowedForSpecficFile.filterCustomPluginsAllowedForSpecificFile)(enabledCustomPlugins, filename); return { plugins: [...neededPostCssPlugins, ...neededCustomPlugins] }; } function postcssPluginGetter(options) { const pluginsOptions = options.css.plugins; const { customPlugins = [] } = options.css; const enabledPlugins = (0, _filterPluginsAllowedForSpecficFile.getEnabledPlugins)(pluginsOptions); const enabledCustomPlugins = customPlugins.filter(conf => conf.enable); return filename => { const allowedPostCssPlugins = getAllowedPostCssPlugins(filename, enabledPlugins, enabledCustomPlugins); return allowedPostCssPlugins; }; }