Skip to content

Commit

Permalink
added fix for dynamic tailwind css
Browse files Browse the repository at this point in the history
  • Loading branch information
assafnoahkoren committed Nov 26, 2023
1 parent 61120f5 commit 6c6ad6d
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 39 deletions.
2 changes: 2 additions & 0 deletions services/client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?

safelist.txt
76 changes: 39 additions & 37 deletions services/client/package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
{
"name": "@sintra/client",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "dotenv -e ../../.env.local vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "dotenv -e ../../.env.local vite preview"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@fontsource/roboto": "^5.0.8",
"@mui/material": "^5.14.18",
"@prisma/client": "^5.6.0",
"firebase": "^10.6.0",
"i18next": "^23.7.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-firebase-hooks": "^5.1.1",
"react-hook-form": "^7.48.2",
"react-i18next": "^13.5.0",
"react-router-dom": "^6.19.0",
"recoil": "^0.7.7"
},
"devDependencies": {
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.3",
"autoprefixer": "^10.4.16",
"postcss": "^8.4.31",
"prettier": "^2.5.1",
"tailwindcss": "^3.3.5",
"typescript": "^5.0.2",
"vite": "^4.4.5"
}
"name": "@sintra/client",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "dotenv -e ../../.env.local vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "dotenv -e ../../.env.local vite build && dotenv -e ../../.env.local vite preview"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@fontsource/roboto": "^5.0.8",
"@mui/material": "^5.14.18",
"@prisma/client": "^5.6.0",
"firebase": "^10.6.0",
"i18next": "^23.7.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-firebase-hooks": "^5.1.1",
"react-hook-form": "^7.48.2",
"react-i18next": "^13.5.0",
"react-router-dom": "^6.19.0",
"recoil": "^0.7.7",
"tailwind-safelist-generator": "^1.0.0",
"tailwindcss": "^3.3.5"
},
"devDependencies": {
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.3",
"autoprefixer": "^10.4.16",
"postcss": "^8.4.31",
"prettier": "^2.5.1",
"tailwindcss": "^3.3.5",
"typescript": "^5.0.2",
"vite": "^4.4.5"
}
}
14 changes: 12 additions & 2 deletions services/client/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/** @type {import('tailwindcss').Config} */

import tailwindSafelistGenerator from 'tailwind-safelist-generator'

export default {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}",],
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
'./safelist.txt'
],
theme: {
extend: {},
},
plugins: [],
plugins: [tailwindSafelistGenerator({
path: 'safelist.txt',
patterns: ['bg-{colors}'],
})],
important: true,
}

5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6150,6 +6150,11 @@ synckit@^0.8.5:
"@pkgr/utils" "^2.3.1"
tslib "^2.5.0"

tailwind-safelist-generator@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/tailwind-safelist-generator/-/tailwind-safelist-generator-1.0.0.tgz#0726a2c84a5506eeb5ef9c7e41706b7f2a148356"
integrity sha512-3SmQijeTyEkP+z5UdOhygUJTm/iA0ic0eaM5O0cmGWyjABfTr/XwcY4nCIA09A4otPz1Ms6tqTCZ/DSRkg3M8A==

tailwindcss@^3.3.5:
version "3.3.5"
resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.3.5.tgz#22a59e2fbe0ecb6660809d9cc5f3976b077be3b8"
Expand Down

0 comments on commit 6c6ad6d

Please sign in to comment.