Linux command
slimrb 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Compile Slim to HTML
slimrb [template.slim]
Compile to file
slimrb [template.slim] [output.html]
Pretty output
slimrb -p [template.slim]
With Rails support
slimrb -r [template.slim]
Compile from stdin
echo "[h1 Hello]" | slimrb
说明
slimrb is the command-line compiler for the Slim template language, a lightweight Ruby templating engine that reduces HTML markup to its essential parts. It reads Slim files and renders them to HTML, ERB, or raw Ruby code for inspection and debugging. Slim uses indentation-based nesting and eliminates closing tags, producing templates that are significantly shorter than equivalent HTML or ERB. The compiler supports pretty-printed output for debugging, Rails-compatible code generation, and conversion to ERB format for use in contexts that don't support Slim directly. The tool integrates with Ruby's Tilt template interface and works with Rails, Sinatra, and other Rack-based frameworks. Plugins can extend the syntax with logic-less templates, translation support, and other features.
参数
- -p, --pretty
- Pretty print HTML.
- -r, --rails
- Rails mode.
- -e, --erb
- Convert from ERB.
- -l, --logic-less
- Logic-less mode.
- -t, --translator
- Translation mode.
FAQ
What is the slimrb command used for?
slimrb is the command-line compiler for the Slim template language, a lightweight Ruby templating engine that reduces HTML markup to its essential parts. It reads Slim files and renders them to HTML, ERB, or raw Ruby code for inspection and debugging. Slim uses indentation-based nesting and eliminates closing tags, producing templates that are significantly shorter than equivalent HTML or ERB. The compiler supports pretty-printed output for debugging, Rails-compatible code generation, and conversion to ERB format for use in contexts that don't support Slim directly. The tool integrates with Ruby's Tilt template interface and works with Rails, Sinatra, and other Rack-based frameworks. Plugins can extend the syntax with logic-less templates, translation support, and other features.
How do I run a basic slimrb example?
Run `slimrb [template.slim]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -p, --pretty do in slimrb?
Pretty print HTML.