[英]Use compass in gem for rails application
I'm trying to create a gem which represents a JS and CSS library and can be included in rails projects (currently using 3.2). 我正在尝试创建一个代表JS和CSS库的gem,并且可以将其包含在rails项目中(当前使用3.2)。 All the style sheets are written in SASS and depend on the compass library. 所有样式表均以SASS编写,并取决于指南针库。
I tried adding compass-rails
to the Gemfile of the "external" gem and including it in the gems SASS files using 我尝试将compass-rails
添加到“外部” gem的Gemfile中,并使用以下命令将其包括在gem SASS文件中
@import "compass"
However, back in the rails application (which has a dependency to this gem), this results in an error message: 但是,回到rails应用程序(与该gem相关),这会导致错误消息:
File to import not found or unreadable: compass.
Am I doing something wrong? 难道我做错了什么?
Update: It seems to work if I add gem compass-rails
to the Gemfile
of the rails application. 更新:如果我将gem compass-rails
Gemfile
gem compass-rails
添加到rails应用程序的Gemfile
,这似乎可以工作。 Any change to work around that? 有任何解决方法吗?
Thanks a lot for your help! 非常感谢你的帮助!
除了在宝石的Gemfile中添加指南针轨道外,还需要在某个地方require 'compass-rails'
,并将其添加到对我lib/your_gem_name.rb
的宝石内部的lib/your_gem_name.rb
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.