小编yam*_*dev的帖子

SCSS 变量和 CSS 变量之间的区别?

我不明白CSS 自定义属性(变量)SCSS 变量之间的区别(顺便说一下,我是 Sass 新手)。

如果这个 CSS 代码:

:root {
    --someColor: coral;
}
  
body {
    background: var(--someColor);
}
Run Code Online (Sandbox Code Playgroud)

获得与以下 SCSS 代码相同的结果:

$someColor: coral;
    
body {
    background: $someColor;
}
Run Code Online (Sandbox Code Playgroud)

为什么引入 SCSS 变量?它们真的和 CSS 变量一样吗,还是我遗漏了什么?

css sass

24
推荐指数
1
解决办法
2万
查看次数

Shadcn UI 安装破坏了 Tailwind CSS

Shadcn UI ( https://ui.shadcn.com/ ) 工作正常,直到我只工作了几周,直到昨天,当我在本地主机中运行我的 NextJS 应用程序时,所有顺风车都不起作用。为了调试这个问题,我在一个全新的文件位置创建了一个空白的 NextJS 13 应用程序,一切正常;tailwind 正在默认的 nextJS 13 页面上工作。然后我跑了

npx shadcn-ui init
Run Code Online (Sandbox Code Playgroud)

无需安装任何组件。它没有吐出任何错误,但随后顺风样式不再起作用。

注入后我的tailwind.config.js:

/** @type {import('tailwindcss').Config} */
module.exports = {
  darkMode: ["class"],
  content: [
    './pages/**/*.{ts,tsx}',
    './components/**/*.{ts,tsx}',
    './app/**/*.{ts,tsx}',
    ],
  theme: {
    container: {
      center: true,
      padding: "2rem",
      screens: {
        "2xl": "1400px",
      },
    },
    extend: {
      colors: {
        border: "hsl(var(--border))",
        input: "hsl(var(--input))",
        ring: "hsl(var(--ring))",
        background: "hsl(var(--background))",
        foreground: "hsl(var(--foreground))",
        primary: {
          DEFAULT: "hsl(var(--primary))",
          foreground: "hsl(var(--primary-foreground))",
        },
        secondary: {
          DEFAULT: "hsl(var(--secondary))",
          foreground: "hsl(var(--secondary-foreground))",
        },
        destructive: {
          DEFAULT: …
Run Code Online (Sandbox Code Playgroud)

next.js tailwind-css

9
推荐指数
2
解决办法
9048
查看次数

标签 统计

css ×1

next.js ×1

sass ×1

tailwind-css ×1