Shopify / prettier-plugin-liquid

Prettier Liquid/HTML plugin
https://npm.im/@shopify/prettier-plugin-liquid
MIT License
94 stars 15 forks source link

Enable .twig file extensions #191

Closed rubas closed 1 year ago

rubas commented 1 year ago

Motivation


We have been successfully using a simple fork of the v0.4 with enabled .twig extension in production since last fall for about a dozen projects. 👍

I do understand that it is not the scope of this project to support TWIG and there will never be an official support. But enabling the plugin for TWIG per default would be extremely valuable for those using it.

Thanks for the consideration.

rubas commented 1 year ago

I have signed the CLA!

charlespwd commented 1 year ago

Thing is there's a lot of things that won't work. Elements that take children require to be flagged as such in the parser, autoescape from the example provided would format as a tag without children, so child tags would appear as sibblings by indentation.

You're free to use it, but I'd use a filetype override in your configuration instead of changing the extension.

You can add this in your settings.json to do that:

  "files.associations": {
    "*.twig": "liquid"
  },