網站首頁 編程語言 正文
react使用windicss
參考官方文檔?Webpack 集成 {#integration-for-webpack} | Windi CSS
react 支持craco框架
windicss有什么不理解的可以參考?Tailwind CSS 中文文檔
1. 安裝 windicss架構
yarn add windicss-webpack-plugin -D
# npm i windicss-webpack-plugin -D
2. 安裝craco
npm install @craco/craco
3. 根目錄下創建 craco.config.js?
// craco.config.js?
?
const WindiCSSWebpackPlugin = require('windicss-webpack-plugin')
?
module.exports = {
? // ...
? webpack: {
? ? plugins: {
? ? ? add: [
? ? ? ? new WindiCSSWebpackPlugin({
? ? ? ? ? virtualModulePath: 'src',
? ? ? ? }),
? ? ? ],
? ? },
? },
}
4. 修改package.json
將react-scripts修改為craco
// package.json?
?
"scripts": {
? - "start": "react-scripts start",
? - "build": "react-scripts build",
? - "test": "react-scripts test",
? - "eject": "react-scripts eject"
?
? + "start": "craco start",
? + "build": "craco build",
? + "test": "craco test",
? + "eject": "craco eject"
5. 在src/index.js 添加如下內容
import './virtual:windi.css'
6. 根目錄下創建 windi.config.js?
// windi.config.js?
?
import { defineConfig } from 'windicss/helpers'
?
export default defineConfig({
? extract: {
? ? include: ['**/*.{jsx,js,css,html}'],
? ? exclude: ['node_modules', '.git', '.next'],
? },
})
原文鏈接:https://blog.csdn.net/qq_48557089/article/details/121852657
相關推薦
- 2023-07-07 React中useState的setState方法請求了好多次
- 2023-05-21 Golang?flag包的具體使用_Golang
- 2022-04-18 antd4.*表格 Each child in a list should have a uniqu
- 2023-12-12 TCP通信的實現-優化點對點聊天
- 2022-09-22 Windows MongoDB服務無法啟動,錯誤 1053的一種情況和解決辦法
- 2022-05-24 用BAT創建文件夾文件及回顯環境變量的問題_DOS/BAT
- 2022-10-27 Python入門之字符串操作詳解_python
- 2022-01-03 比較throw和 throws的異同
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支