cra-template-tailwindcss-typescript
A streamlined Tailwind CSS v2.0 template for Create React App in TypeScript.
Usage
npx create-react-app my-app --template tailwindcss-typescript
Experimental JIT mode
You can enable Just-in-Time "JIT" mode by uncommenting mode: "jit"
in tailwind.config.js
.
IMPORTANT: Do NOT comment purge
when you enable JIT mode, otherwise your CSS will be empty!
module.exports = {
// Uncomment the line below to enable the experimental Just-in-Time ("JIT") mode.
// 👇👇👇👇👇
// mode: "jit",
theme: {
extend: {},
},
// other options...
};
Credits
This project was made possible thanks to the following projects.
- GeoffSelby/cra-template-tailwindcss - A streamlined Tailwind CSS template for Create React App (in JavaScript).
- cra-template-typescript - An official TypeScript template for create-react-app.
License
MIT © Sung M. Kim
✨
Contributors Thanks goes to these wonderful people (emoji key):
Ivo Angelov |
Roger Chi |
Jag Reehal |
Michael |
Mustafa YILDIZ |
This project follows the all-contributors specification. Contributions of any kind welcome!
"sleep" does not work on Windows
Hello
"react-scripts:start": "sleep 5 && react-scripts start",
does not work as "sleep" is not present on win.I'm doing
"react-scripts:start": "timeout /t 1 /nobreak > NUL && react-scripts start",
wanted to point it out, maybe it's something you would like to fix
Replace autoprefixer with postcss preset env
This is a good template but to make it great (😉) I'd replace autoprefixer with postcss-preset-env which includes autoprefixer and additional polyfills
Powershell: npm start fails with 'sleep' is not recognized as an internal or external command
First of all, great project. Secondly, using bash on Windows successfully open
localhost:3000
. However, the command fails when using Powershell. I'm not sure whether this is a Powershell-specific error or not.Here's the whole error:
Dependencies not added when using NPX
Hi. I am trying this template out with Node + Yarn on Windows. First I run this command:
But I found out that the generated project can't be run right away.
I ended up adding these packages, either to global or to the project's dependencies:
Should these be described in README section for getting started?
Or better, should most of these be added to (dev) dependencies in the template from the start?
UPDATE
After testing further, it seems to be the issue with
npx create-react-app
that does not add the dependencies topackage.json
. Usingyarn create react-app
did it as in this commentIgnore Tailwind-processed CSS file and remove it from template
I don't think it's necessary to keep the processed CSS under version control. The file is generated automatically when the development server starts. Also, since GitHub determines repository language stats using file size, repositories using this template display a distorted CSS percentage figure.
Update Tailwind CSS to the latest version (1.4.4)
Version 1.4.0 adds built-in support for PurgeCSS: https://github.com/tailwindcss/tailwindcss/releases/tag/v1.4.0
The
@fullhuman/postcss-purgecss
andpurgecss
dependencies aren't needed anymore, so I removed them.build script doesn't actually get NODE_ENV=production into postcss
When running npm run build, the run-s command executes the "env:prod" script in a separate command than the "build:css" command, so NODE_ENV=production is not persisted into the postcss call. I suggest adding "cross-env NODE_ENV=production" directly into the build:css script, e.g.:
This is the file size change after making this modification to package.json for a vanilla project using cra-template-tailwindcss-typescript:
more detailed documentation
Hi,
I manage to add your template with the npx command. But I have some questions
(1) you say we enable JIT by changing tailwind.config.js to add "mode: "jit"," but what about postcss.config.js that still looks the following? Shouldn't that be changed as well "tailwindcss" to "tailwindcss/hit" ?
(2) IMPORTANT: Do NOT comment purge when you enable JIT mode, otherwise your CSS will be empty!
(3) As this is a custom build tailwind project how do we use it? When to run the following scripts:
build:css": "cross-env TAILWIND_MODE=build NODE_ENV=production postcss src/styles/tailwind.css -o src/styles/index.css", "watch:css": "cross-env TAILWIND_MODE=watch NODE_ENV=development postcss src/styles/tailwind.css -o src/styles/index.css --watch", "react-scripts:start": "sleep 5 && react-scripts start",
Bump lodash from 4.17.20 to 4.17.21
Bumps lodash from 4.17.20 to 4.17.21.
Commits
f299b52
Bump to v4.17.21c4847eb
Improve performance oftoNumber
,trim
andtrimEnd
on large input strings3469357
Prevent command injection through_.template
'svariable
optionDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
Bump ini from 1.3.5 to 1.3.8
Bumps ini from 1.3.5 to 1.3.8.
Commits
a2c5da8
1.3.8af5c6bb
Do not use Object.create(null)8b648a1
don't test where our devdeps don't even workc74c8af
1.3.7024b8b5
update deps, add linting032fbaf
Use Object.create(null) to avoid default object property hazards2da9039
1.3.6cfea636
better git push script, before publish instead of after56d2805
do not allow invalid hazardous string as section nameMaintainer changes
This version was pushed to npm by isaacs, a new releaser for ini since your current version.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
Replace CRACO with Macro
Context: https://www.reddit.com/r/reactjs/comments/flebuh/how_to_add_tailwind_to_unejected_createreactapp/
KCD's code: https://github.com/kentcdodds/bookshelf/commit/b984b34239aee9f57fb7bf8868b7e78dfe475ae8
CRA Custom Templates: https://create-react-app.dev/docs/custom-templates/