简体   繁体   English

将haml js转换为slim

[英]Convert haml js to slim

I'm trying to convert a haml template to slim. 我正在尝试将haml模板转换为苗条。 The view includes javascript. 该视图包括javascript。 I am getting an error saying expected closing '}' when accessing the slim view that was generated using haml2slim. 在访问使用haml2slim生成的苗条视图时,我收到一条错误消息,指出预期关闭'}'。 How can I convert the js below to working in slim? 如何将下面的js转换为苗条?

_.haml _.haml

:javascript
  var client = new Client({
    projectId: "#{ENV['...']}",
    readKey: "#{..::ReadKey.new(
                  ENV['..'], {
                  filters:  [{
                    property_name: "account_id",
                    operator: "eq",
                    property_value: @account.id
             }]}).encrypt!}"
  });

haml2slim haml2slim

javascript:
  | var client = new Client({
    | projectId: "#{ENV['...']}",
    | readKey: "#{...::ReadKey.new(
                  | ENV['...'], {
                  | filters:  [{
                    | property_name: "account_id",
                    | operator: "eq",
                    | property_value: @account.id
             | }]}).encrypt!}"
  | });

I believe the colon should come after javascript like this: 我相信冒号应该像这样 javascript 之后出现

javascript:
  var client = new Client({
    projectId: "#{ENV['...']}",
    readKey: "#{..::ReadKey.new(
                  ENV['..'], {
                  filters:  [{
                    property_name: "account_id",
                    operator: "eq",
                    property_value: @account.id
             }]}).encrypt!}"
  });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM