rails javascript_include_tag 和 stylesheet_link_tag 上的 URI 错误 [英] Bad URI on rails javascript_include_tag and stylesheet_link_tag

查看:34
本文介绍了rails javascript_include_tag 和 stylesheet_link_tag 上的 URI 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我从这个项目中抽出了几个月的时间,今天去了它并尝试托管它,但没有触及任何东西,我在两个指向我的 javascript 和 css 的链接上遇到了错误的 URI 错误.

So I took a few months out from this project, went to it today and tried to host it, and without touching anything I am getting a bad URI error on two links to my javascript and css.

<%= javascript_include_tag "application", "data-turbolinks-track": "reload" %>

<%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track": "reload" %>

那些是导致错误的两段代码.有谁知道可能是什么问题,我已经尝试了双引号/单引号的所有组合,但无济于事.

Those are the two pieces of code causing the errors. Does anyone know what the problem could be, I have tried all combinations of double/single quotes but to no avail.

任何帮助将不胜感激!

Application.js:

Application.js:

    // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require jquery-ui




$(window).scroll(function() {
    var distanceFromTop = $(this).scrollTop();
    if (distanceFromTop >= $('.navbar').height()) {
        $('#sticky').fadeIn('1000').addClass('fixed');
    } else {
        $('#sticky').removeClass('fixed');
    }
});



$(document).ready(function() {
    $(".dropdown-toggle").dropdown();
});

应用程序.css

    /*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 *= require jquery-ui
 */

body {
    font-family: sans-serif;
    background-color: white;
    color: #686868;
}

@media (min-width: 768px) and (max-width: 991px) {
    .navbar-collapse.collapse {
        display: none !important;
    }
    .navbar-collapse.collapse.in {
        display: block !important;
    }
    .navbar-header .collapse, .navbar-toggle {
        display:block !important;
    }
    .navbar-header {
        float:none;
    }




}



* {
    border-radius: 0;
}

.navbar{
    -webkit-border-radius: 0;
    -moz-border-radius: 0;
    border-radius: 0;
}

.navbar .navbar-nav {
    display: inline-block;
    float: none;
    vertical-align: top;
    margin-left: auto;
    padding: 0;
}

.navbar .navbar-collapse {
    text-align: center;
    border-radius: 0;
}

a {
    color: #1b7b90;
}

a:hover {
    color: #1b7b90;
    text-decoration: none;
}

hr {
    border: 0;
    height: 1px;
    background: #333;
    background-image: linear-gradient(to right, #ccc, #333, #ccc);
}

.property-link:hover {
    color: white;
}

.property-fixedbar {
    color: white;
    text-align: center;
    border-style: solid;
    border-width: 1px;
    border-color: white;
    margin-top: 12px;
    padding-top: auto;
}

.property-fixedbar:hover {
    color: #1b7b90;
    background-color: white;
}

.main-content {
    color: #686868;
}

.search-button:hover {
    background-color: black;
}

.table th{
    text-align: center;
}

#sticky {
    z-index: 10;
    height: 67px;
}


#sticky.fixed {
    display: block;
    position: fixed;
    top: 0;
    width: 100%;
}

.navBar-wrapper {
    height: 67px;
}

@media (min-width: 10px) and (max-width: 991px) {
    .navBar-wrapper {
        height: 150px;
    }

    #sticky {
        height: 100px;
    }

    #show-top {
        height: 180px;
    }

    #sticky.fixed {
        position: relative;
    }

    .fixed-summary {
        position: absolute;
        margin: 0;
    }
    .thumbnail-images {
        display: none;
    }
}

.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
    margin: auto;
}

#myCarousel {
    margin-left: 30px;
    margin-right: 30px;
}

.carousel-control {
    padding-top: 25%;
}
.carousel-control.left, .carousel-control.right {
    background: none;
    color: #1b7b90;
    border: none;
}

.hide-bullets {
    list-style:none;
    margin-left: 0;
    margin-top:20px;
}

.thumbnail {
    padding: 0;
}

.carousel-inner>.item>img, .carousel-inner>.item>a>img {
    width: 100%;
}

.green {
    color: green;
}

.red {
    color: red;
}

推荐答案

我遇到了完全相同的错误,这让我抓狂.

I had exactly the same error and it drove me nuts.

我猜这与 URI(废话!)有关,我终于将我的项目文件夹从 Google Drive 移到我的桌面,运行 bundle、rails db:migrate、rails assets:precompile 然后 rails s.事实证明,它为我修好了.

I'm guessing this has something to do with the URI (duh!) and I finally moved my project folder out of Google Drive to my desktop, running bundle, rails db:migrate, rails assets:precompile and then rails s. Turns out that fixed it for me.

这篇关于rails javascript_include_tag 和 stylesheet_link_tag 上的 URI 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆