简体   繁体   English

WrapBootstrap模板不起作用

[英]WrapBootstrap template doesn't work

I just purchased a wrap bootstrap template and tried to use it on a ruby on rails app. 我刚购买了一个wrap bootstrap模板,并尝试在Rails应用程序的ruby上使用它。 I pasted all its images files under my local /app/assets/images folder, js files under /app/assets/javascripts , html files under /app/views and all css files under /app/assets/stylesheets . 我将其所有图像文件粘贴到本地/app/assets/images文件夹下,js文件/app/assets/javascripts ,html文件/app/views和所有css文件下/app/assets/stylesheets

When I just clicked the html file it's working correctly. 当我单击html文件时,它可以正常工作。 But when I tried to run localhost, it just showed the basic html files without any pictures or font styles. 但是,当我尝试运行localhost时,它只显示了基本的html文件,没有任何图片或字体样式。

Yes. 是。 I ran into this Exact problem myself recently. 我本人最近遇到了这个确切问题。 The way I solved this was to: 我解决此问题的方法是:

Open the downloaded WrapBootstrap template contents (example mine had various pages but two main folders Documentation and HTML). 打开下载的WrapBootstrap模板内容(我的示例有多个页面,但有两个主文件夹Documentation和HTML)。 Inside of the HTML folder there should be a sub folder named assets . 在HTML文件夹中,应该有一个名为asset的子文件夹。 Copy and paster this entire folder into you public folder. 将整个文件夹复制并粘贴到公用文件夹中。

The next step which had me beating my head into the table was when you use a page of the HTML in the template the CSS and JS is all referenced in a similiar way example: 下一步让我大吃一惊的是,当您在模板中使用HTML页面时,所有CSS和JS都以类似的方式引用:

      <link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">

      <script type="text/javascript" src="assets/js/plugins/layer-slider.js"></script>

But when you place it into your application.html.erb file you need to make sure you place a leading / (slash) in front of assets like so: 但是,当您将其放入application.html.erb文件时,您需要确保在资产前面放置一个前导/ (斜杠),如下所示:

        <link rel="stylesheet" href="/assets/plugins/bootstrap/css/bootstrap.min.css">

      <script type="text/javascript" src="/assets/js/plugins/layer-slider.js"></script>

So that now the assets are being referenced from an absolute path rather than a relative one. 因此,现在从绝对路径而不是相对路径中引用资产。

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

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