How to convert erb file to haml

I will leave it as a memorandum.

1, add gem

gemfile


gem "haml-rails"

Terminal


bundle install
2, convert erb file to haml

Terminal


rails haml:erb2haml

Terminal


Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)
y
Deleting original .erb files.

You will be asked if you want to delete the original erb file. Answer with y or n.

That's it!


Since haml does not need to close the tag, the amount of code can be reduced and simplified, but due to indent management, an error will occur if there is any deviation. However, no matter who writes it, it has a similar structure and is highly readable, so I would like to actively use it.

Recommended Posts

How to convert erb file to haml
[Rails] How to convert from erb to haml
[Ruby] How to convert CSV file to Yaml (Yml)
How to convert Java radix
How to convert a file to a byte array in Java
[Easy] How to automatically format Ruby erb file with vsCode
How to convert LocalDate and Timestamp
[Beginner] How to delete NO FILE
How to change from HTML to Haml
[Xcode] How to add a README.md file
[Java] How to use the File class
How to delete the wrong migration file
How to delete the migration file NO FILE
How to add jar file in ScalaIDE
[Core ML] How to convert YOLO v3 to Core ML
How to achieve file download with Feign
How to convert java.util.Date, java.sql.Date, LocalDate, ZonedDateTime
Try changing the .erb file to .slim
How to split Spring Boot message file
How to achieve file upload with Feign
How to deploy
[Ruby] How to convert from lowercase to uppercase and from uppercase to lowercase
[Android] How to convert a character string to resourceId
How to dump from database (DB) to seeds file
How to convert a solidity contract to a Java contract class
How to bind to property file in Spring Boot
Rails "How to delete NO FILE migration files"
[Spring Boot] How to refer to the property file
Ruby How to convert between uppercase and lowercase
[Rails] How to convert UC time display to Japanese time display
<java> Read Zip file and convert directly to string
Mastering Kotlin ~ Convert Java File to Kotlin File Road to Graduation ~ Part 3
How to develop OpenSPIFe
How to call AmazonSQSAsync
How to use Map
How to jump from Eclipse Java to a SQL file
How to use rbenv
How to use letter_opener_web
How to use with_option
How to use fields_for
How to use java.util.logging
[Java] How to extract the file name from the path
How to use collection_select
How to embed youtube videos using iframe tags (haml)
How to adapt Bootstrap
How to use Twitter4J
How to use active_hash! !!
How to install Docker
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
Convert csv file to fixed length record file using enum
How to write dockerfile
[How to insert a video in haml with Rails]
How to uninstall Rails
How to install docker-machine
[How to use label]
How to make shaded-jar
How to write docker-compose
How to use identity
How to use hashes