Stavať Next.JS a tailwindcss

0

Otázka

Používam TailwindCSS a NextJs pre svoju aplikáciu. Všetko funguje, keď som npm run dev ale keď som npm run build potom npm run start Mám niekoľko tried, ktoré nie sú v práci. Pre exemple v tomto kódexe, h-20 / text-white nefungujú, ale iné vietor triedy sú dokonale pracuje...

<div class="flex text-white font-semibold cursor-pointer">
<div class="flex-1 h-20 center-hv text-center bg-blue-primary hover:bg-blue-hover button-shadow">
    <div>
        <div>Acheter 200 €</div>
    </div>
</div> 
</div>

Tam je môj confs :

//next.config.js

module.exports = {
    images: {
      domains: ["picsum.photos"],
    },
    env: {
      customKey: 'my-value',
    }
  }
//postcss.config.js

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
}
//tailwind.css

module.exports = {
  purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {
      backgroundColor: theme => ({
        ...theme('colors'),
        'blue-primary': '#A9C4D2',
        'blue-secondary': '#bbd9e8',
        'blue-hover': '#74afcd',
        'alert-info': '#d5e9f3',
        'alert-warning': '#ffd585',
        'alert-danger': '#ffb3b3'
      }),
      textColor: theme => ({
        ...theme('colors'),
        'blue-primary': '#A9C4D2',
        'blue-secondary': '#bbd9e8',
        'blue-hover': '#74afcd',
        'alert-info': '#d5e9f3',
        'alert-warning': '#ffd585',
        'alert-danger': '#ffb3b3'
      }),
    },
    flex: {
      '1': '1 1 0%',
      '2': '2 2 0%',
      '3': '3 3 0%',
      '4': '4 4 0%',
      '5': '5 5 0%',
      auto: '1 1 auto',
      initial: '0 1 auto',
      inherit: 'inherit',
      none: 'none',
    }
  },
  variants: {
    extend: {},
  },
  plugins: [],
}
//jsconfig.json

{
    "typeAcquisition": {
        "include": ["jest"]
    }
}
//_app.js

import Navigation from '../componsants/navigation/Navigation'
import '../styles/globals.css'
import 'tailwindcss/tailwind.css'

function MyApp({ Component, pageProps }) {

  return (
    <>
      <div className="mtb">
        <Navigation />
        <Component {...pageProps} />
      </div>
    </>
  )
}

export default MyApp

Neviem, ak máte nejaké nápady ? Sledoval vietor dokumenty, ale vyzerá to, že to nie je dosť ahah

Thx

javascript next.js reactjs tailwind-css
2021-11-23 22:50:03
2
0

Ak niektoré triedy sú nefunguje, a inú pracovnú = skontrolovať tailwind.css

Tiež, máte príklad Nextjs - Vietor

P. S. Váš kód testu

2021-11-25 11:03:21
0

Našiel som odpoveď v iných post a testovanie Pretože som niektoré komponenty, ktoré sú na conditionnal vykresľovanie a pri budovaní svojej aplikácii vietor nevytvárajte triedy

Ak chcete vyriešiť tento môžete :

  • Vymazať vymazanie v tail conf (ale to by malo byť dočasné)
  • Vytvárať zložky a vyhlasovania všetky triedy budete musieť
2021-11-25 10:51:20

V iných jazykoch

Táto stránka je v iných jazykoch

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................