Most of solution that exist in the internet is tell you to create a task and call it using ctrl-shift-p menu.
This extension basically using htmlbeautifier to format your file using the Formatter API from the vscode, so no need to create a hack using Task, etc.
gem install htmlbeautifier
or
To use the gem with Bundler, add to your Gemfile:
gem 'htmlbeautifier'NOTE: For you that have a filename with extension .html.erb, your file might be recognized as html file, not as erb file. In that case, add a setting in your settings.json like below:
"[erb]": {
"editor.defaultFormatter": "aliariff.learning",
"editor.formatOnSave": true
},
"files.associations": {
"*.html.erb": "erb"
}-
invalid byte sequence in US-ASCIIAdd below setting. Reference
"learning.customEnvVar": { "LC_ALL": "en_US.UTF-8" }
| Setting | Description | Default |
|---|---|---|
learning.executePath |
Path to the htmlbeautifier executable, set this to absolute path when you have different htmlbeautifier location | htmlbeautifier |
learning.useBundler |
Execute htmlbeautifier using bundler (ie 'bundle exec htmlbeautifier'). If this true, learning.executePath is ignored | false |
learning.bundlerPath |
Path to the bundler executable, set this to absolute path when you have different bundler location | bundle |
learning.tabStops |
Set number of spaces per indent | 2 |
learning.tab |
Indent using tabs | false |
learning.indentBy |
Indent the output by NUMBER steps | 0 |
learning.stopOnErrors |
Stop when invalid nesting is encountered in the input | false |
learning.keepBlankLines |
Set number of consecutive blank lines | 0 |
learning.customEnvVar |
Custom environment variables to pass to the htmlbeautifier | {} |
