Local Docker html2haml – VS Code Extension 🧰
Minimal VS Code extension that converts selected ERB/HTML to HAML (and back) using Docker and replaces the selection in-place ✨
Prerequisites ✅
- Docker Desktop is running 🐳
- VS Code CLI
code is available:
- In VS Code: Command Palette → Shell Command: Install 'code' command in PATH
vsce is available (checked automatically during build).
Install / Build (recommended) 🚀
Copy/paste (clone, build, install) 📋:
git clone https://github.com/flavegmbh/local-docker-html2haml-vscode-extension.git
cd local-docker-html2haml-vscode-extension
make
Or if you already have the repo, run this in the project folder:
make
What make does 👇
- sets the extension version in
package.json to 0.0.<unixtime> (VS Marketplace compatible)
- builds the Docker image:
local/html2haml:latest
- packages the extension as a
.vsix via vsce package
- installs the latest generated
.vsix via code --install-extension ... --force
Then reload VS Code once 🔄
⇧⌘P → Developer: Reload Window
Usage 🎯
- Select ERB/HTML or HAML in the editor.
- Open the Command Palette (
⇧⌘P).
- Run one of:
- Convert Selection from HTML -> HAML (Docker html2haml)
- Convert Selection from HAML -> HTML (Docker html2haml)
Command IDs:
dockerHtml2haml.convertSelection
dockerHtml2haml.convertSelectionHamlToHtml
Build the Docker image manually (optional) 🧱
docker build -t local/html2haml:latest .
Docker smoke test (optional) 🧪
make test-docker
Troubleshooting 🛠️
“Docker not found”
- Install/start Docker Desktop and make sure
docker is on your PATH.
“Cannot connect to the Docker daemon” / permission errors
- Start Docker Desktop, possibly log out/in.
html2haml: command not found
- Rebuild image:
docker build -t local/html2haml:latest .
- Then run
make and Reload Window.
Changes don’t take effect after make
- VS Code caches extensions:
⇧⌘P → Developer: Reload Window
- Alternatively:
⇧⌘P → Developer: Restart Extension Host
| |