简体   繁体   English

通过Rails 4 App上的相对路径调用Slider Revolution资产

[英]Calling Slider Revolution assets through relative paths on Rails 4 App

question reworked for clarity and brevity 为了清楚和简洁起见,对问题进行了重新设计

I am trying to install the [Slider Revolution][1] plugin on my Rails 4 application and I am having trouble with dynamically created relative paths in the jquery.themepunch.revolution.js file. 我正在尝试在Rails 4应用程序上安装[Slider Revolution] [1]插件,但是在jquery.themepunch.revolution.js文件中动态创建相对路径时遇到了麻烦。 The javascript snippet that I've placed on the page (as per the docs) sets a parent directory via this code: 我放置在页面上的javascript代码段(根据文档)通过以下代码设置了父目录:

 jsFileLocation:"../../revolution/js/",

This directory tells the code in jquery.themepunch.revolution.js where to find the "extensions" folder. 该目录告诉jquery.themepunch.revolution.js中的代码在哪里找到“扩展”文件夹。

But, if I use that bit of js on my page I get this error 但是,如果我在页面上使用了那部分js,则会收到此错误

Slider Revolution 5.0 Error !
Failure at Loading:revolution.extension.navigation.min.js on Path:extensions/

as the js is telling the browser to search HERE for the file: js告诉浏览器在此处搜索文件:

http://localhost:5000/revolution/js/extensions/revolution.extension.actions.min.js

when in reality the actual location is something like: 实际上,实际位置类似于:

http://localhost:5000/assets/javascripts/plugins/revolution/extensions/revolution.extension.actions.min.js

I've tried setting the js snippet to the following options: 我尝试将js代码段设置为以下选项:

jsFileLocation:"../../assets/",
jsFileLocation:"../../assets/javascripts/",
jsFileLocation:"/assets/",
jsFileLocation:"/assets/javascripts/plugins/revolution/",
jsFileLocation:"/assets/plugins/revolution/",

It still doesn't work. 它仍然不起作用。

Please try /assets/plugins/revolution/ as the js location. 请尝试/assets/plugins/revolution/作为js位置。 I am assuming you haven't tried it. 我假设您还没有尝试过。

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

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