如何在Ruby中使用sass-rails帮助器? [英] How to use sass-rails helpers in Ruby?

查看:83
本文介绍了如何在Ruby中使用sass-rails帮助器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Github页面中,似乎可以使用Sass帮助器(asset_pathasset_urlimage_path等),但我不知道怎么做.

From the Github page it would seem that one can use the Sass helpers (asset_path, asset_url, image_path etc.) in Ruby but I can't figure out how.

我需要为Paperclip附件设置default_url,并要使用资产管道中的其中一项资产.

I need to set the default_url for a Paperclip attachment and want to use one of my assets from the asset pipeline for that.

推荐答案

您可以在SCSS文件中使用sass帮助器,但不能在其他地方使用它们.在这些情况下,您需要使用常规的asset_path和image_tag帮助器.

You can use the sass helpers in SCSS files, but you cannot use them elsewhere. In those cases you need to use the regular asset_path and image_tag helpers.

这篇关于如何在Ruby中使用sass-rails帮助器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆