HelpingWithSolutions
HelpingWithSolutions

Reputation: 45

How do inline tailwind CSS and multiple file tailwind CSS differs?

Do we have to write it inline like:

@tailwind base;
@tailwind components;
@tailwind utilities;

or in separate files like:

Upvotes: 1

Views: 1134

Answers (1)

monte
monte

Reputation: 1885

Your index.css file can contain utility classes. You use a tailwind command tailwind -i index.css -o output.css to build and generate a css file.

In your html file: you need to use tailwind inline in class attribute:

<body class="text-white border border-blue-400">

    you rest of body
</body>

One last this you need is tailwind configuration file, which is automatically created when you run tailwind init in your working directory. This configuration file looks something like this:

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ['**/*.html'],
  theme: {
    extend: {},
  },
  plugins: [],
}

The purpose for this file is to check if any html file is using tailwind classes and if so based on that render output.css when you run build command.

Upvotes: 1

Related Questions