Skip to content

Commit

Permalink
improvement: Enhance addLessLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
Anish-Agnihotri authored May 28, 2020
2 parents 03701d7 + 438c335 commit b2eca7d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/customizers/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,21 @@ export const enableEslintTypescript = () => config => {
return config;
};

export const addLessLoader = (loaderOptions = {}) => config => {
export const addLessLoader = (loaderOptions = {}, customCssModules = {}) => config => {
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const postcssNormalize = require("postcss-normalize");

const cssLoaderOptions = loaderOptions.cssLoaderOptions || {};
const cssModules = loaderOptions.cssModules || {
localIdentName: "[local]--[hash:base64:5]"
};

const { localIdentName } = loaderOptions;
let cssModules = loaderOptions.cssModules || { localIdentName };

if (!cssModules.localIdentName) {
cssModules = customCssModules;
}

cssModules.localIdentName = cssModules.localIdentName || "[local]--[hash:base64:5]";

const lessRegex = /\.less$/;
const lessModuleRegex = /\.module\.less$/;

Expand Down

0 comments on commit b2eca7d

Please sign in to comment.