【问题标题】:Tailwind CSS not buildingTailwind CSS 未构建
【发布时间】:2020-08-05 09:16:42
【问题描述】:

我目前正在练习一些 tailwindcss 前端设计。我已经使用 npm 安装了它,我没有收到任何错误。我为tailwindcss制作了构建脚本。当我运行适当的命令来构建tailwindcss 时,它不会将其输出到我设置为输出文件的style.css 文件中。我也没有收到任何错误。这是package.json 文件的代码:

{
  "name": "design",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "build:css": "tailwindcss build src/style.css -o dist/style.css"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "tailwindcss": "^1.3.4"
  }
}

【问题讨论】:

    标签: html css tailwind-css


    【解决方案1】:

    添加脚本的正确方法:-

    "build": "npx tailwindcss build src/style.css -o dist/style.css"
    

    【讨论】:

      【解决方案2】:

      您的命令中似乎缺少npx,请尝试以下操作:

      npx tailwindcss build src/style.css -o dist/style.css

      https://tailwindcss.com/docs/installation/#4-process-your-css-with-tailwind

      【讨论】:

      • 我试过了,还是不行。等等,如果我在创建tailwind.config.js 文件之前运行它,构建会工作吗?
      • 嗯我认为它应该可以工作,配置文件应该是可选的。但无论如何都要尝试:npx tailwindcss init
      • 我试过了,还是不行,我不知道为什么。我也尝试将它与 reactjs 一起使用,但它也不起作用。编辑:我在 ReactJs 应用程序的 postcss.config.js 文件中输入错误,现在可以使用,谢谢。
      • 啊完美!快乐编码!
      猜你喜欢
      • 2021-04-10
      • 2021-12-06
      • 2021-09-02
      • 2021-10-23
      • 2021-06-09
      • 2021-08-16
      • 2021-11-29
      • 2021-03-22
      • 1970-01-01
      相关资源
      最近更新 更多