0.0.6 • Published 11 months ago
@4az/prettier-plugin-html-erb v0.0.6
@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-ruby
yarn add -D prettier @4az/prettier-plugin-html-erb @prettier/plugin-ruby
pnpm install --save-dev prettier @4az/prettier-plugin-html-erb @prettier/plugin-ruby
Ruby
If you want to install the dependencies globally:
gem install bundler prettier_print syntax_tree
Or 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.rb
Configuration
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:
- 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 test
Special thanks
@davidodenwald for his plugin prettier-plugin-jinja-template which served as a base for this plugin.