"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getCSSLoaders = getCSSLoaders;

var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));

var _getCssLoaderOptions = require("./loaderConfigs/getCssLoaderOptions");

var _postcssPlugins = require("./postcssPlugins");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function getCSSLoaders(options) {
  const neededPostCssPlugins = (0, _postcssPlugins.postcssPlugins)(options);
  const cssLoaderOptions = (0, _getCssLoaderOptions.getCssLoaderOptions)(options);
  return [_miniCssExtractPlugin.default.loader, {
    loader: 'css-loader',
    options: cssLoaderOptions
  }, neededPostCssPlugins.length && {
    loader: 'postcss-loader',
    options: {
      postcssOptions: {
        plugins: neededPostCssPlugins
      }
    }
  }].filter(Boolean);
}