Skip to content

Commit 6e5234e

Browse files
authored
docs(Theming): use @semantic-ui-react/craco-less plugin (#3767)
1 parent 36f1533 commit 6e5234e

1 file changed

Lines changed: 4 additions & 35 deletions

File tree

docs/src/pages/Theming.mdx

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ yarn remove semantic-ui semantic-ui-css
8080

8181
### Install required dependencies
8282

83-
Create React App does not support LESS out of the box, we and propose to use [`@craco/craco`](https://www.npmjs.com/package/@craco/craco) to add it and avoid `eject`. You have to install required packages:
83+
Create React App does not support LESS out of the box, we and propose to use [`@craco/craco`](https://www.npmjs.com/package/@craco/craco) to add its support and avoid `eject`. You have to install required packages:
8484

8585
```bash
86-
npm install @craco/craco craco-less semantic-ui-less --save-dev
86+
npm install @craco/craco @semantic-ui-react/craco-less semantic-ui-less --save-dev
8787
```
8888

8989
```bash
90-
yarn add @craco/craco craco-less semantic-ui-less --dev
90+
yarn add @craco/craco @semantic-ui-react/craco-less semantic-ui-less --dev
9191
```
9292

9393
And then update your `package.json` and create `craco.config.js`:
@@ -104,39 +104,8 @@ And then update your `package.json` and create `craco.config.js`:
104104
```
105105

106106
```jsx label=craco.config.js
107-
const { getLoader, loaderByName, throwUnexpectedConfigError } = require('@craco/craco')
108-
109107
module.exports = {
110-
webpack: {
111-
alias: {
112-
'../../theme.config$': require('path').join(__dirname, '/src/semantic-ui/theme.config'),
113-
},
114-
},
115-
plugins: [
116-
{ plugin: require('craco-less') },
117-
{
118-
plugin: {
119-
overrideWebpackConfig: ({ context, webpackConfig }) => {
120-
const { isFound, match: fileLoaderMatch } = getLoader(
121-
webpackConfig,
122-
loaderByName('file-loader'),
123-
)
124-
125-
if (!isFound) {
126-
throwUnexpectedConfigError({
127-
message: `Can't find file-loader in the ${context.env} webpack config!`,
128-
})
129-
}
130-
131-
fileLoaderMatch.loader.exclude.push(/theme.config$/)
132-
fileLoaderMatch.loader.exclude.push(/\.variables$/)
133-
fileLoaderMatch.loader.exclude.push(/\.overrides$/)
134-
135-
return webpackConfig
136-
},
137-
},
138-
},
139-
],
108+
plugins: [{ plugin: require('@semantic-ui-react/craco-less') }],
140109
}
141110
```
142111

0 commit comments

Comments
 (0)