问题标签 [slim-lang]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ruby-on-rails - 如何在 Slim 文件中有多个 `yield`s/`content_for`s?
这是我的基本 Slim 文件:
这是某个控制器的特定 Slim 文件:
使用它会给我“语法错误,意外';'”。
基本上,我的问题是,如何yield
在一个 Slim 文件中有两个 s?像这样:
css - Stylus css within Slim template with Sinatra
I'm using Sinatra, and I'm trying to use Slim for the HTML and Stylus for the the CSS.
I'm unsure of what the correct way to do this is. What I've got at the moment works (locally, I've not tried deploying), but I'm wondering if this is the most efficient way of doing things.
My layout.slim file has:
.. in the head. Is this the best way using Stylus stylesheets, or should I set up a /style path in the sinatra app.rb?
My code is below:
This is my app.rb
In the views folder, I have a layout.slim which looks like this
An index.slim which looks like this
In the same folder as app.rb, I have style.styl:
ruby-on-rails - Rails:从生成器中调用渲染
我刚刚开始尝试使用生成器。在我生成的视图模板之一中,我想这样调用render
:
当我尝试使用生成器时,出现此错误:
Rails 真的不能render
从生成器中调用吗?还是我做错了什么?
ruby-on-rails-3.2 - Slim 中的案例陈述
有没有办法在 Slim 中为以下示例编写 case 语句。我对 StackOverflow 问题做了一些更改:How to write a switch statement in Ruby
我尝试了以下但产生错误。
这就是我被告知的
ruby-on-rails-3.2 - Ruby on Rails - 使 Slim 成为默认模板
我正在开发一个 Ruby on Rails 项目,需要自定义 Gems 提供的默认视图。
要求是使用 Slim 作为模板。我知道 ERB 是 Rails 的默认模板引擎。
根据我的观察,优先级是 ERB,如果不是,它将使用 Slim/Haml 视图。
我有兴趣知道是否可以将 Slim 设置为默认值而不是 ERB?
如何实现这一点,以便当我在 Slim 中创建模板的本地版本时,它将覆盖 gem 提供的模板。
任何线索将不胜感激。
ruby-on-rails-3.2 - RoR - Slim - If Tag - 在行尾添加分号
我是 Ruby on Rails 的新手,我发现它是一种迷人的语言。但是有些方面我不是很了解,也没有时间看书。所以任何帮助将不胜感激。
关于项目的一些基本信息:
- 导轨 3.2
- 红宝石 2.0
- 瘦身
- 大礼包电子商务框架
我正在尝试编写一个 if 块来仅在当前页面不是购物袋页面时才显示 HTML 块。
这是我的代码:
当我运行该页面时,我收到以下错误:
我认为这是一个 Slim 错误。current_page(cart_path)?
来自框架的文档,因为我写自己的逻辑还不够成熟。
有什么问题?提前致谢。
aptana3 - Aptana Studio 3 Slim 支持
我正在使用 Aptana Studio 3 进行 Ruby on Rails 开发。我正在从事的项目使用 Slim ( http://slim-lang.com/ )。我希望找到对超薄文件类型的编辑器和格式支持。到目前为止,我的谷歌搜索有一些空白。
ruby-on-rails - Flash 和 redirect_to 在一行中不产生 Flash
我有以下代码
通常,如果我flash[:notice]
在重定向上方设置一个值,则 Flash 会显示在我的页面上,但是当我使用上面的代码时,它不会。
我显示闪光灯的代码是
写完后= flash.inspect
我收到了
这当然是使用 SLIM 模板语言编写的。我的问题是notice
实际产生了什么,我该如何调整我的代码来修复它?谢谢。
html - Slim 和 Rails 问题
基本上我试图在 Rails 和 Slim 中得到这个输出:
这是我到目前为止所拥有的:
显然它输出:
my<strong>name</strong>
在页面上而不是解释强标签。有什么想法吗?
ruby-on-rails - slim - 出乎意料的keyword_ensure,期待输入结束
我使用 Slim 来表达我的观点,并且有这个:
现在,这是导致问题的 link_to 行,如果我将其替换为纯div
文本,则一切正常,但使用 link_to 会导致:
关于什么是错的任何想法?