@4az/prettier-plugin-html-erb
v0.0.7
Published
Prettier plugin for formatting html erb templates.
Maintainers
Readme
@4az/prettier-plugin-html-erb
A prettier plugin for html erb template files that works with prettier v3.
Install
Node
npm install --save-dev prettier @4az/prettier-plugin-html-erb @prettier/plugin-rubyyarn add -D prettier @4az/prettier-plugin-html-erb @prettier/plugin-rubypnpm install --save-dev prettier @4az/prettier-plugin-html-erb @prettier/plugin-rubyRuby
If you want to install the dependencies globally:
gem install bundler prettier_print syntax_treeOr if you are using bundler:
bundler add prettier_print syntax_tree --group="development"If you're having problems, check the repository of @prettier/plugin-ruby.
Use
Add the plugins to your .prettierrc:
{
"plugins": ["@prettier/plugin-ruby", "@4az/prettier-plugin-html-erb"]
}If any file doesn't format, check the output running prettier in the terminal:
npx prettier ./src/myfile.html.rbConfiguration
This plugin doesn't have any special config. You can configure the ruby formatting using the options of @prettier/plugin-ruby.
Roadmap
There are a number of features I want to support:
- [x] Support erb delimiters. Ex:
<%- delimiters -%>. - [ ] Port library to TypeSript.
- [ ] Add a way to ignore sections of code of being formatted.
- [ ] Support more ways to format blocks.
Testing
To run tests:
git clone https://github.com/ForAzens/prettier-plugin-html-erb.git
cd prettier-plugin-html-erb
npm install
gem install bundler prettier_print syntax_tree
npm run testSpecial thanks
@davidodenwald for his plugin prettier-plugin-jinja-template which served as a base for this plugin.
