dylanirlbeck / tailwind-ppx

A Reason/OCaml Pre-Processor eXtension (PPX) that validates your Tailwind classes at compile-time.
MIT License
152 stars 15 forks source link

Extractor issues with bsb -clean-world #58

Closed sync closed 4 years ago

sync commented 4 years ago

If i run a bsb clean before running build, bsb will remove the tailwind.css file and then when i run build it fail to compile saying the tailwind.css file is missing. At the end of this process (even with a build failure) the generator will generate the tailwind.css file. Next time i run bsb build it compiles properly.

dylanirlbeck commented 4 years ago

Can you send me your bsconfig.json and/or send me a GH repo that I can use to reproduce? I might need to circle back on the generator logic, so it might be best to remove it for now.

sync commented 4 years ago
{
  "name": "meet-app",
  "sources": [
    {
      "dir": "src",
      "subdirs": true,
      "generators": [
        {
          "name": "gen-tailwind",
          "edge": ["tailwind.css", ":", "main.css"]
        }
      ]
    }
  ],
  "generators": [
    {
      "name": "gen-tailwind",
      "command": "tailwindcss build $in -o $out"
    }
  ],
  "bs-dependencies": [
    "reason-react",
    "re-classnames",
    "reason-relay",
    "bs-fetch",
    "decco",
    "reason-promise",
    "bs-webapi",
    "re-classnames"
  ],
  "ppx-flags": [
    "reason-relay/ppx",
    "bs-let/ppx",
    "decco/ppx",
    ["@dylanirlbeck/tailwind-ppx/tailwind-ppx", "-path ./src/tailwind.css"]
  ],
  "reason": { "react-jsx": 3 },
  "package-specs": {
    "module": "es6",
    "in-source": true
  },
  "suffix": ".bs.js",
  "bsc-flags": ["-bs-super-errors", "-bs-no-version-header"],
  "refmt": 3,
  "warnings": {
    "error": "+101"
  }
}
dylanirlbeck commented 4 years ago

So I did some investigation, and added the generator definition to the demo project. This seems to be an unavoidable issue with how the generator works --- I think your best bet is to separate our the clean and build/watch steps so you're not cleaning the project each time (if you're doing this already).

I'll close this for now, though maybe someone will have a better solution in the future, in which case I'll thread below.