在Ruby in Rails资产管道中添加一个新文件夹

时间:2022-05-04 00:26:41

I'm utilizing a bootstrap template and it requires a plugin for a revolution slider. I'm used to check the source code of the template and remove individual JS and CSS files it requires and place them in the asset pipeline. Is there any way to import into the asset pipeline the entire plugin folder with all of its files?

我正在使用一个bootstrap模板,它需要一个旋转滑块的插件。我习惯于检查模板的源代码并删除它需要的单个JS和CSS文件,并将它们放在资产管道中。有没有办法将整个插件文件夹及其所有文件导入资产管道?

Here is a picture of what the folder contains:

这是该文件夹包含的图片:

在Ruby in Rails资产管道中添加一个新文件夹

UPDATE

UPDATE

I've added the rs-plugin to the assets portion of my app:

我已将rs-plugin添加到我的应用的资源部分:

在Ruby in Rails资产管道中添加一个新文件夹

In application.rb I've added the following:

在application.rb中,我添加了以下内容:

config.assets.paths << Rails.root.join("assets", "rs-plugin-5")

In assets/javascripts/application.js I've added the following:

在assets / javascripts / application.js中,我添加了以下内容:

//= require rs-plugin-5/js/jquery.themepunch.tools.min
//= require rs-plugin-5/js/jquery.themepunch.revolution.min

I am getting the following error:

我收到以下错误:

在Ruby in Rails资产管道中添加一个新文件夹

1 个解决方案

#1


1  

Yes, you can do it by adding next line to config/application.rb:

是的,您可以通过在config / application.rb中添加下一行来实现:

config.assets.paths << Rails.root.join('/path/to/folder')

#1


1  

Yes, you can do it by adding next line to config/application.rb:

是的,您可以通过在config / application.rb中添加下一行来实现:

config.assets.paths << Rails.root.join('/path/to/folder')