#Astro Tailwind

13 messages · Page 1 of 1 (latest)

tame vortex
#

First time using tailwind. So I've a stylesheet where I'm using some basic style that I want to use like: h5 {font-size: 1.200rem; /* 19.2px */}. During the npm dev the font-size is not getting applied and is replaced by the tailwind value of font-size : inherit;. But after getting deployed on vercel / npm build. It's using the stylesheet. How do I get it to work normally in dev.
astro.config.mjs

import { defineConfig } from 'astro/config';
import vercel from "@astrojs/vercel/serverless";
import tailwind from "@astrojs/tailwind";
// https://astro.build/config
export default defineConfig({
  output: "hybrid",
  adapter: vercel(),
  integrations: [tailwind()]
});
/** @type {import('tailwindcss').Config} */
module.exports = {
    content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
    theme: {
        extend: {},
    },
    plugins: [],
}
nocturne knot
tame vortex
# nocturne knot You could try to customize base styles: https://tailwindcss.com/docs/adding-base...

When I used @tailwind base; in my css the @tailwind is getting underlined saying Unknown at rule @tailwind. I still kept going

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

@layer base {
  h5 {
      font-size: 1.2rem;
  }
// also tried 
  h5 {
  @apply text-xl;
  }
}

it's still not getting applied in the npm dev though. But showing up on inspect but crossed.
Do I have to import @tailwind ?? In the docs they're just using @tailwind. I dont know what I'm doing wrong.
Why is it tailwind taking precedence in npm dev but is getting replaced after build?

tame vortex
#

note! using stylesheet as import onto the astropage layout.

nocturne knot
#

I see your problem. I was dealing with this strange behavior before. I can apply uppercase or text-color-red-500 on h1 but not the font-size... Is it an issue on Tailwind ? https://github.com/tailwindlabs/tailwindcss/issues/1460

GitHub

My tailwind.css file includes the following ... h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; } This obviously breaks h1 etc. What if the proper way for me to fix this? Also, w...

vapid zodiac
tame vortex
vapid zodiac
tame vortex
vapid zodiac
#

It is trying to warn you that the rule may not exist even though it does, I am not too sure how to fix this though

tame vortex
nocturne knot
#

Hi @Malik. Could you post your final result? I don't undertsand why certain rules work but not font-size or @apply text-4xl. Could someone points me the difference ?

tame vortex