Skip to content

Instantly share code, notes, and snippets.

@adipasquale
Created December 21, 2022 15:00
Show Gist options
  • Save adipasquale/df1a45ccbba50635f0cdf925a1492caa to your computer and use it in GitHub Desktop.
Save adipasquale/df1a45ccbba50635f0cdf925a1492caa to your computer and use it in GitHub Desktop.
VSCode command to convert html.erb to haml
# scripts/html2haml.sh
ls $1 | sed 'p;s/.erb$/.haml/' | xargs -n2 bundle exec html2haml --ruby19-attributes -E utf-8:utf-8
ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/é/é/g'
ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/è/è/g'
ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/ /\ /g'
ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/«/«/g'
ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/»/»/g'
ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/à/à/g'
ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/’/ʼ/g'
ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/fi/fi/g'
ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/œ/œ/g'
ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/î/î/g'
ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/\À/À/g'
# ls $1 | sed 's/.erb$/.haml/' | xargs sed -i '' 's/à/à/g'
// VSCode Key Binding
{
"key": "ctrl+shift+h",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "./scripts/html2haml.sh ${file}\u000D"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment