Linux command
haml 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Convert HAML to HTML
haml [input.haml] [output.html]
Convert from stdin
cat [input.haml] | haml
Use Rails mode
haml --rails [input.haml]
Pretty print output
haml -f [input.haml]
Check HAML syntax
haml -c [input.haml]
说明
HAML (HTML Abstraction Markup Language) is a templating language that compiles to HTML. It uses indentation for nesting and provides a concise syntax for HTML elements, attributes, and embedded Ruby. HAML is commonly used in Ruby on Rails applications but can be used standalone for any HTML generation.
参数
- -c, --check
- Check syntax only.
- -f, --format _format_
- Output format: html5, html4, xhtml.
- -e, --escape-html
- Escape HTML by default.
- -r, --require _file_
- Require Ruby library.
- --style _style_
- Output style: nested, expanded, compact, compressed.
- -s, --stdin
- Read from stdin.
- -t, --trace
- Show full stack trace.
FAQ
What is the haml command used for?
HAML (HTML Abstraction Markup Language) is a templating language that compiles to HTML. It uses indentation for nesting and provides a concise syntax for HTML elements, attributes, and embedded Ruby. HAML is commonly used in Ruby on Rails applications but can be used standalone for any HTML generation.
How do I run a basic haml example?
Run `haml [input.haml] [output.html]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c, --check do in haml?
Check syntax only.