How to use craco-less - 1 common examples

To help you get started, we’ve selected a few craco-less examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DocSpring / craco-antd / lib / craco-antd.js View on Github external
if (pluginOptions.customizeTheme) {
    Object.assign(modifyVars, pluginOptions.customizeTheme);
  }

  const lessLoaderOptions = pluginOptions.lessLoaderOptions || {};
  if (lessLoaderOptions.modifyVars) {
    Object.assign(modifyVars, lessLoaderOptions.modifyVars);
  }

  lessLoaderOptions.modifyVars = modifyVars;
  // javascriptEnabled: true is suggested in the Ant Design docs:
  // https://ant.design/docs/react/customize-theme#Customize-in-webpack
  lessLoaderOptions.javascriptEnabled = true;

  return CracoLessPlugin.overrideWebpackConfig({
    context,
    webpackConfig,
    pluginOptions: {
      styleLoaderOptions: pluginOptions.styleLoaderOptions || {},
      cssLoaderOptions: pluginOptions.cssLoaderOptions || {},
      postcssLoaderOptions: pluginOptions.postcssLoaderOptions || {},
      lessLoaderOptions,
      modifyLessRule: pluginOptions.modifyLessRule,
      miniCssExtractPluginOptions:
        pluginOptions.miniCssExtractPluginOptions || {}
    }
  });
};

craco-less

A Less plugin for craco / react-scripts / create-react-app

MIT
Latest version published 1 year ago

Package Health Score

60 / 100
Full package analysis

Popular craco-less functions