Some Beginner Question #1813
-
Good day fellas.
My use case: I just want to use tailwindCSS in my project like bootstrap(that's all). |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Hi, Here is a pretty soft introduction to PostCSS. |
Beta Was this translation helpful? Give feedback.
-
To just get started, you don't even need to touch PostCSS. It's just 2 steps:
@tailwind base;
@tailwind components;
@tailwind utilities;
This will create an That's all you need to start. You can read more here https://tailwindcss.com/docs/installation/#using-tailwind-cli When you finish your layout, or find that you need to extend some utilities, change fonts, etc, you can create a config file
This will create module.exports = {
theme: {},
variants: {},
plugins: [],
} Say now you want to remove unused styles, because right now your file is almost 3MB large. That's when you can add the module.exports = {
purge: [ './src/**/*.html' ],
theme: {},
variants: {},
plugins: [],
} In this case, all my classes are written inside the You can read more here: https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css In the end, in your simple case, you would finish by adding minification. That's when PostCSS gets in and you would probably be well served with these: https://tailwindcss.com/course/setting-up-tailwind-and-postcss https://tailwindcss.com/docs/using-with-preprocessors/#using-postcss-as-your-preprocessor |
Beta Was this translation helpful? Give feedback.
-
Is there no way to minify the css output? There sould be a cli option PS: I don't need to purge the css, only minify. |
Beta Was this translation helpful? Give feedback.
To just get started, you don't even need to touch PostCSS. It's just 2 steps:
style.css
) with:npx tailwindcss build styles.css -o output.css
This will create an
output.css
file that you can use in your HTML.That's all you need to start. You can read more here https://tailwindcss.com/docs/installation/#using-tailwind-cli
When you finish your layout, or find that you need to extend some utilities, change fonts, etc, you can create a config file
npx tailwindcss init
This will create
tailwind.config.js
with this content: