Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow yml files to be named yml.erb #355

Open
iHiD opened this issue Jun 2, 2021 · 2 comments
Open

Allow yml files to be named yml.erb #355

iHiD opened this issue Jun 2, 2021 · 2 comments

Comments

@iHiD
Copy link

iHiD commented Jun 2, 2021

It would be nice if I could name the skylight.yml to be skylight.yml.erb. I currently get yaml parse errors when committing my version of that file, as it contains multiline ERB, which Ruby parses fine, but Prettier baulks at. Being able to append the erb extension would fix this.

This may already be the case, in which case please feel free to close this (although it might be worth making it clearer in the docs as I missed it, or equally feel free to tell me I'm just not looking hard enough!)

Thanks 🙂

@zvkemp
Copy link
Contributor

zvkemp commented Jun 3, 2021

Hi @iHiD! I just tried out Prettier on a skylight.yml.erb file, and it seems not to correctly infer a parser for .erb files (it tried using the Ruby parser). Is there a particular plugin you are using for ERB support? If so, you can add an override to your .prettierrc.json file:

    {
      "files": ["config/skylight.yml"],
      "options": {
        "parser": "erb"
      }
    }

If not, it might be best to add it to .prettierignore.

@iHiD
Copy link
Author

iHiD commented Jun 3, 2021

Thanks for the answer :)

I don't actually particularly mind about it prettifying the ERB, the real issue was that it totally exploded trying to parse the YAML file when it contained multiline erb. So by naming it to yml.erb it won't try and prettify it as yaml and break.

But yes, .prettierignore is the good local fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants