Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Tailwind 4 @reference '#tailwindcss' doesn't work when style is <style lang='postcss'>

オープン
#998 コメント 0 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
css, nuxt, tailwind, typescript

調査の方向性

Start with nuxt.config.ts and reproduce the issue in a Vue component using the shown scoped lang="postcss" style block. Compare resolution of @reference '#tailwindcss' with the package.json #importtailwindcss workaround, and verify the fix in production mode; done means nested PostCSS and @apply work without the workaround.

索引モデルが issue の本文から書いたものです。

説明

question

Versions:
"@nuxtjs/tailwindcss": "^7.0.0-beta.0",
"nuxt": "^3.17.5"

nuxt.config.ts

{
  postcss: {
	plugins: {
		"@tailwindcss/postcss": {
			optimize: false // also I need to set optimize to false in order to work on production mode
		},
		"postcss-nested": {},
	}
 }
}

When the style is set to the following (postcss), then it throws errors or does nothing

<style lang='postcss' scoped>
@reference '#tailwindcss';

.ct-base__item{
  @apply flex;

  &--red{
    @apply text-red-500;
  }
}

</style>

The workaround I found is to set the following in package.json

  "imports": {
    "#importtailwindcss": "./app/assets/css/tailwind.css"
  }

Then in Vue file, I can use @reference '#importtailwindcss' to make it work again.

<style lang='postcss' scoped>
@reference '#importtailwindcss';

.ct-base__item{
  @apply flex;

  &--red{
    @apply text-red-500;
  }
}

</style>

Or not using PostCSS also works but I cannot use nested feature

<style lang='css' scoped>
@reference '#tailwindcss';

.ct-base__item{
  @apply flex;
}

.ct-base__item--red{
    @apply text-red-500;
 }
</style>

Anyone else having the same issue?

also to make postcss work on production see this thread

主要言語
TypeScript
スター
1.9k
フォーク
192
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nuxt-modules/tailwindcss のほかの issue

nuxt-modules/tailwindcss の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。