next-plugin-less
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Next.js + Library Like Antd (with Less)

JavaScript Style Guide Build Status semantic-release

Use Antd Or Library like Antd (with Less) with Next.js.

If you use nextjs, antd and less, you may use babel-plugin-import to dynamically import less style files in antd. You can use the default configuration of this library.

If you use other libraries with similar structures and also import less style files through babel-plugin-import, then you can also use this library, just customize the configuration libsStyleRegExp to exclude server-side compilation styles.

Usage

module.exports = withLess(
  withMDX({
    /**
     * @default  "/(antd\/.*?\/style).*(?<![.]js)$/"
     * */  
    libsStyleRegExp: /(antd|other-libs)\/.*?\/style.*?/, //  Exclude libs style when compiling server
    cssLoaderOptions: {
      modules: {
        mode: "local",
        auto: (resource) => {
          if (resource.match("node_modules")) {
            return false;
          }
          if (resource.match("src")) {
            return true;
          }
          return false;
        },
      },
    },
  }),
);

Package Sidebar

Install

npm i next-plugin-less

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

26.1 kB

Total Files

15

Last publish

Collaborators

  • mengfei0053