haml - 在没有 Rails 的情况下使用 HAML,如何在部分下嵌套元素?
问题描述
我正在使用 HAML,没有导轨。我希望能够使用部分,但在部分下嵌套项目。这可能吗?每次我尝试时,我都会收到一条错误消息:Errno::ENOENT: No such file or directory @ rb_sysopen
. 这是我正在尝试的示例:
设置脚本
sudo gem install haml
应用程序.rb
def RENDER_COMPONENT(display, anchor)
contents = File.read("component.haml")
Haml::Engine.new(contents).render
end
组件.haml
.data
父.haml
:ruby
require_relative "app"
!!!
%html
%body
=RENDER_COMPONENT()
%h1= "Test"
%H2= "Test"
命令行
haml parent.haml index.html
解决方案
推荐阅读
- hadoop - 将可选属性从主 oozie 工作流传递到子工作流
- reactjs - Jest 用箭头函数测试 JSX 元素
- json - CSV 转 JSON 并添加标题
- linux - 在 Linux 上以编程方式检测触摸板移动与常规鼠标
- firebase - firbease 功能冷启动的加载视图
- javascript - Primefaces PickList 限制传输元素的数量
- javascript - 如何使用 CdkScrollable 检测角度材料 2 自动完成列表上的滚动事件
- javascript - 如何添加缩略图供用户选择卫星视图?
- sql - 从 Access 2016 中的日期时间字段中解析时间
- android - MediaRecorder 和 VideoSource.SURFACE,停止失败:-1007(一个严重的 Android 错误)