Comments (8)
Description
I am struggling to install/use
TailwindCSS
I am using v1.2.4 updated to React18.1.0
, react-router6.3.0
react-script5.0.1
(everything works fine).Steps to reproduce
> yarn create react-app --template cra-template-rb my-app
> cd my app
> yarn -D tailwindcss postcss autoprefixer
> yarn tailwindcss init -p
Add the following code to
tailwind.config.js
content: [ "./src/**/*.{js,jsx,ts,tsx}", ],Add the following declaration to
src/styles/global-style.ts
@tailwind base; @tailwind components; @tailwind utilities;Expected behavior
The css is not applied, css class are in the dom, but the tailwind's css isn't load.
Thank you for your help.
I think you forgot to include the index.html
in the public
folder into the content
property of your tailwind.config.js
that is why your TailwindCSS did not work.
Try to do it like this.
content: ['./public/index.html', './src/**/*.{js,jsx,ts,tsx,html}'],
This is my tailwind.config.js
in my personal project that I currently working on using the latest release of the boilerplate at the time of this response. I have no issues of tailwindcss in my end. Hope this helps.
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./public/index.html', './src/**/*.{js,jsx,ts,tsx,html}'],
theme: {
screens: {
// Small devices (landscape phones, 576px and up)
sm: '576px',
// Medium devices (tablets, 768px and up)
md: '768px',
// Large devices (desktops, 992px and up)
lg: '992px',
// X-Large devices (large desktops, 1200px and up)
xl: '1200px',
// XX-Large devices (larger desktops, 1400px and up)
xxl: '1400px',
},
fontFamily: {
sans: [
'Inter',
'-apple-system',
'BlinkMacSystemFont',
'Helvetica Neue',
'Helvetica',
'sans-serif',
],
},
extend: {},
},
plugins: [require('@tailwindcss/forms')],
};
Also this my devDependencies
in package.json
"devDependencies": {
"@tailwindcss/forms": "0.5.2",
"autoprefixer": "10.4.7",
"postcss": "8.4.14",
"prettier-plugin-tailwindcss": "0.1.11",
"tailwindcss": "3.1.4"
}
from react-boilerplate-cra-template.
I have the same issue and put together an example branch: https://github.com/Silthus/betonquest-editor/tree/issues/cra-boilerplate-tailwindcss
from react-boilerplate-cra-template.
I already used tailwind before. It was working. Removed it later though so cannot really remember. It wasn't a problem. There should be something you are missing I assume?. This is a create-react-app and if it works there it should work here too.
If you give example repo I can check as well
from react-boilerplate-cra-template.
I tried with the official create-react-app typescript template
, and I didn't have any issue, everything work fine.
Maybe it's a configuration issue (specific to this "ecosystem", like the .babel-plugin-macrosrc.js
file or something like that.
from react-boilerplate-cra-template.
maybe. As I said if you give me minimal example repo without any business logic inside I can try to see what blocks it
from react-boilerplate-cra-template.
Thank you @Silthus for the example repo, what do you think about it @Can-Sahin ?
from react-boilerplate-cra-template.
does the answer above fixes it?
from react-boilerplate-cra-template.
no fixes it
from react-boilerplate-cra-template.
Related Issues (20)
- This is the most retarded boilerplate I have ever seen HOT 2
- Automating releases, tags, version, and the generation of the CHANGELOG.md file with github actions HOT 1
- Unable to resolve dependency tree HOT 3
- useInjectReducer updates store, leading to warning "Cannot update a component (x) while rendering a different component..." HOT 6
- Routing through <Link/> and <Navlink/> react-router-dom components did not work properly HOT 1
- How to setup Micro Front End apps with this template HOT 1
- How can i configured webpack for optimise.
- How to jump page in saga HOT 1
- Similar template for Next.js HOT 1
- CSS with Media Queries are Not Minified (SOLUTION ATTACHED) HOT 2
- Doesn't work until you manually add devDependencies to package.json HOT 1
- Installing and starting the template app results in the error 'Plugin "react" was conflicted between ".eslintrc.js"' HOT 2
- about Emotion css-in-js HOT 5
- Ejecting from CRA HOT 1
- yarn start gives error about styled-components with babel-plugin-macros. HOT 1
- Request to Make This Repository a Template HOT 1
- When we get new changes? HOT 1
- Unable to create React App with node 20 and yarn 4
- Discontinued ! (Checkout the example)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-boilerplate-cra-template.