zth / reasonml-q-a

ReasonML Q & A - Questions and answers for everything ReasonML.
https://reasonml-q-a.netlify.com
44 stars 0 forks source link

Are there community recommendations for using "in-source": false? #16

Open rastreus opened 4 years ago

rastreus commented 4 years ago

Question

This is somewhat related to "#3 Should you .gitignore .bs.js files?" I understand the thoughts behind wanting to commit the generated files, but for a new, greenfield project, I would prefer the directory cleanliness of setting "in-source": false so that the generated .bs.js files are contained in lib.

Are there any community recommendations or guidelines for doing this and maintaining require references to css files and other assets? Or is setting "in-source": false so uncommon and/or discouraged that there are not any real recommendations for doing so?

Answer

This question hasn't been answered yet.

Further reading

zth commented 4 years ago

This is a great question! And I hope we can get someone a bit more experienced with BuckleScript to comment. Personally, I understand the cleanliness argument, but it does have the potential of messing up the requires (like you say) with, to my knowledge, no clear way of solving it.

Looking forward to responses to this. Maybe @yawaramin has input here?

baransu commented 4 years ago

My personal experience with both greenfield and brownfield applications is always using "in-source": true. It makes require and bindings to local (not from node_modules) modules simpler. Also tools like cristianoc/genType require you to use "in-source": true. My rule of thumb is also ignoring bs.js and gen.js files and making them hidden in IDE. This way there is no difference in terms of cleaners and makes you always know that ./ is where your Reason file is.

When using BuckleScript without bundler it may be reasonable to use "in-source": false but I also have no experience in that field.

rastreus commented 4 years ago

@baransu Thank you. This is exactly what I was trying to find.

For Visual Studio Code, I have added the following .vscode/setting.json file:

// Hide the generated .bs.js files
{
  "files.exclude": {
      "**/*.bs.js": true,
  }
}