简体   繁体   English

在ruby gem中安装rails资产

[英]Install rails assets in a ruby gem

I am transforming a ruby plugin to a ruby gem. 我正在将ruby插件转换为ruby gem。 In the plugin I was able to run 在插件中,我能够运行

rake gem_name:install

This would install javascript and images into the rails assets directory. 这会将javascript和图像安装到rails资产目录中。 Can I automate this, so when i include the gem in mijn gemfile, this is all included automatically? 我可以自动执行此操作,因此当我在mijn gemfile中包含gem时,这些都会自动包含在内吗?

What is the way of doing this? 这样做的方法是什么?

You don't need install your styles and scripts into the rails app in rails 3.1 and 3.2. 您不需要将样式和脚本安装到rails 3.1和3.2中的rails应用程序中。

Just put them into app/assets , lib/assets or vendor/assets ; 只需将它们放入app/assetslib/assetsvendor/assets ; and add Rails::Engine class to you gem (it can be empty). 并将Rails::Engine类添加到gem(它可以为空)。

Guides 指南

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

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