简体   繁体   中英

How to only use relative paths in Rails, instead of using the asset pipeline?

I am trying to integrate components from multiple websites into my own Rails website. Their images, CSS files, and JavaScript files are numerous and scattered in deeply nested directories. If I copy their folders into the 'app/assets' folder, I will get something like this:

app/assets/website1/a/b/c/d/image1.jpg
app/assets/website2/e/f/g/style.css
app/assets/website3/h/i/j/k/custom.js

If I try to reference the above items with:

<img src="/app/assets/website1/a/b/c/d/image1.jpg">
<link rel="stylesheet" href="/app/assets/website2/e/f/g/style.css">
<script src="/app/assets/website3/h/i/j/k/custom.js"></script>

respectively, they will not load at all. I would greatly prefer to use relative paths because using the asset pipeline would be a nightmare with such deeply nested directories. Is what I am describing even possible?

Have you tried disabling the asset pipeline in config/application.rb by adding the following line to it ?

config.assets.enabled = false

Havn't tested it. Let me know if it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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