Giter Club home page Giter Club logo

webpack-multiple-themes-compile's Introduction

React Suite logo

English | 中文版

npm GitHub Actions npm bundle size codecov Discord Gitter Gitter Gitpod ready-to-code

React Suite is a set of React components. It is committed to providing high-quality and comprehensive React components to help developers quickly build web applications.

Supported Platforms

Browser

React Suite supports the latest, stable releases of all major browsers and platforms. IE<=10 is no longer supported since React Suite 5.0. React Suite is designed and implemented for use on modern desktop browsers rather than mobile browsers.

IE Edge Firefox Chrome Safari
>=11 >=14 >= 45 >= 49 >= 10

Server

React Suite supports server side rendering. Support Next.js to build applications.

Installation

React Suite is available as an npm package.

# with npm
npm install rsuite

# with Yarn
yarn add rsuite

# with pnpm
pnpm add rsuite

# with Bun
bun add rsuite

Usage

import { Button } from 'rsuite';
import 'rsuite/styles/index.less'; // or 'rsuite/dist/rsuite.min.css'

function App() {
  return <Button appearance="primary">Hello World</Button>;
}

More guides on how to get started are available here.

Documentation

It's the https://rsuitejs.com website for the latest version of React Suite. For older versions head over here

The previous major version 4.x will no longer receive new features, and it is recommended to upgrade to the latest 5.x releases. Bug fixes for 4.x are still being supported for a period of time, and security fixes are supported until 6.x is in progress.

Framework Guides

React Suite can be used in your favorite framework. We have prepared step-by-step guides for these frameworks:

Changelog

Detailed changes for each release are documented in the release notes.

Contribution

Make sure you've read the guidelines before you start contributing.

Sponsoring services

These great services help us to build and maintain the project.

Service Description
GitHub Github lets us host the Git repository and coordinate contributions.
Vercel Vercel provides the hosting for the documentation site.
CodeCov CodeCov lets us monitor test coverage.
Gitee Gitee grants us GVP - Gitee Most Valuable Open Source Project.
CodeSandbox CodeSandbox lets us provide live previews of the components.
Stackblitz Stackblitz lets us provide live previews of the components.

Supporting React Suite

If you like React Suite, you can show your support by either

This project exists thanks to all the people who contribute.

opencollective-now

License

React Suite is MIT licensed.

webpack-multiple-themes-compile's People

Contributors

dependabot[bot] avatar hiyangguo avatar sevenoutman avatar superman66 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webpack-multiple-themes-compile's Issues

Work with CSS Modules

Hi :)

Is there any way to configure this plugin to work with CSS Modules enabled?

(I'm using less, if it matters)

Thanks!

Compatibility with CRA

Hi!

This issue is already kind of open in rsuite#947, but I thought I should open the issue here (where I think it belongs) with some more details.

I am trying to use webpack-multiple-themes-compile with CRA through react-app-rewired. My packages' versions are:

webpack-merge: 4.2.2,
webpack-multiple-themes-compile: 2.0.0
react-app-rewired: 2.1.6,
react: 16.8.6

And I am trying to override CRA's configuration with the following config-overrides.js (which is a based on this repository's README):

const { override } = require('customize-cra');

const merge = require('webpack-merge');
const multipleThemesCompile = require('webpack-multiple-themes-compile');

module.exports = function override(config, env) {
  // Merge default config with themes config
  return merge(
    config,
    multipleThemesCompile({
      themesConfig: {
        green: {
          color: '#008000'
        },
        yellow: {
          color: '#ffff00'
        }
      },
      lessContent: 'body{color:@color}'
    })
  );
}

But even though the compilation is successful, the application doesn't start as I only see a blank page. I think it is because the entry points of the default config and the ones generated by multipleThemesCompile are not being merged correctly as their definitions don't look compatible. This is how they look:

/* config */
{
  entry: [ '/my/path/node_modules/react-dev-utils/webpackHotDevClient.js', '/my/path/src/index.js' ]
  // more stuff
}
/* result from multipleThemesCompile */
{
  entry: {
    green: '/my/path/node_modules/webpack-multiple-themes-compile/lib/src/less/themes/green.js',
    yellow: '/my/path/node_modules/webpack-multiple-themes-compile/lib/src/less/themes/yellow.js'
  }
  // module, plugins, optimization
}

So the resulting merged object apparently just takes the entry from the latter (I am not writing the other attributes here as they seem to be merged correctly, but as I am no webpack expert, I am not 100% sure) which would explain why my application doesn't load but the css files do seem to load.

I have tried some things like merging manually, merging the entry points with Derek-Hu/react-app-rewire-multiple-entry, but each of them throws different errors.

Is there a workaround for this or am I doing something wrong?

My final goal is to achieve runtime theme switching (like in Rsuite's website) with custom light and dark themes (i.e. light mode with base_color : green and dark mode with base_color : red).

Thanks!

编译时候为什么报这样的错误

ERROR in (webpack)-multiple-themes-compile/lib/src/less/themes/red.less
Module build failed (from ./node_modules/less-loader/dist/cjs.js):

exports = module.exports = require("../../../../../css-loader/dist/runtime/api.js")(false);
^
Unrecognised input

themes css content is null

created themes css content is null.
Why.
How to resolve it.
Please tell me, thank you.

multipleThemesCompile({
themesConfig: {
green: {
color: '#008000'
},
yellow: {
color: '#ffff00'
}
},
styleLoaders: [
{ loader: 'css-loader' },
{
loader: 'less-loader'
}
],
lessContent: 'body{color:@color}',
cwd: path.resolve('./'),
cacheDir: './src/less/themes',
outputName:themeName => ${themeName}.css
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.