简体   繁体   English

在Rails 4应用程序中实现wrapbootstrap主题的问题

[英]Issues implementing a wrapbootstrap theme with rails 4 app

Rails noob here. Rails noob在这里。

I've been fumbling through the process of integrating a wrapbootstrap one page parallax theme ( https://wrapbootstrap.com/theme/ashley-one-page-parallax-WB0R11207 ) into my rails 4 app. 我一直在尝试将wrapbootstrap一页视差主题( https://wrapbootstrap.com/theme/ashley-one-page-parallax-WB0R11207 )集成到我的rails 4应用程序中。

After unzipping the files, the index.html page works (mostly), right out of the box. 解压缩文件后,index.html页面可以正常使用(大部分)。

The process I've gone through in the attempt to integrate it into a new rails app: 我尝试将其集成到新的Rails应用程序中所经历的过程:

  • Transfer all CSS files to assets/stylesheets folder 将所有CSS文件传输到资产/样式表文件夹
  • Transfer all JS files to assets/javascripts folder 将所有JS文件传输到asset / javascripts文件夹
  • Referenced all JS and CSS files in application.js and application.css 在application.js和application.css中引用了所有JS和CSS文件
  • Transfer all images to assets/images folder 将所有图像传输到资产/图像文件夹
  • Generate new pages controller/view, and moved the previously discussed html file into this view 生成新的页面控制器/视图,并将先前讨论的html文件移动到该视图中
  • Assigned root to above html file 将根分配给上述html文件

The issue I'm running into is that the all of the JS and CSS don't appear to be executing. 我遇到的问题是所有JS和CSS似乎都没有执行。 I have JS and CSS include tags in the header. 我在标题中有JS和CSS包含标签。

I've tried rake assets:precompile, but that wasn't successful. 我已经尝试过rake asset:precompile,但是没有成功。

Any tips on where I'm going wrong here? 关于我在这里出错的任何提示?

Additionally, the index.html file includes a bunch of CSS setup in the head, ie: 另外,index.html文件的头部包括一堆CSS设置,即:

<!-- Bootstrap  -->
<link type="text/css" rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- web font  -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,800" rel="stylesheet" type="text/css">
<!-- plugin css  -->
<link rel="stylesheet" type="text/css" href="js-plugin/animation-framework/animate.css" />
<link rel="stylesheet" type="text/css" href="js-plugin/magnific-popup/magnific-popup.css" />
<link type="text/css" rel="stylesheet" href="js-plugin/isotope/css/style.css">
<link rel="stylesheet" type="text/css" href="js-plugin/flexslider/flexslider.css" />
<link rel="stylesheet" type="text/css" href="js-plugin/pageSlide/jquery.pageslide.css" />
<!-- Owl carousel-->
<link rel="stylesheet" href="js-plugin/owl.carousel/owl-carousel/owl.carousel.css">
<link rel="stylesheet" href="js-plugin/owl.carousel/owl-carousel/owl.theme.css">

and a bunch of javascrip tags at the bottom of the body, ie: 在主体底部还有一堆javascrip标签,即:

<script type="text/javascript" src="js-plugin/respond/respond.min.js"></script>
<script type="text/javascript" src="js-plugin/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="js-plugin/jquery-ui/jquery-ui-1.8.23.custom.min.js"></script>
<!-- third party plugins  -->
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="js-plugin/easing/jquery.easing.1.3.js"></script>

<script type="text/javascript" src="js-plugin/flexslider/jquery.flexslider-min.js"></script>

<script type="text/javascript" src="js-plugin/isotope/jquery.isotope.min.js"></script>
<script type="text/javascript" src="js-plugin/neko-contact-ajax-plugin/js/jquery.form.js"></script>
<script type="text/javascript" src="js-plugin/neko-contact-ajax-plugin/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="js-plugin/magnific-popup/jquery.magnific-popup.min.js"></script>
<script type="text/javascript" src="js-plugin/parallax/js/jquery.scrollTo-1.4.3.1-min.js"></script>
<script type="text/javascript" src="js-plugin/parallax/js/jquery.localscroll-1.2.7-min.js"></script>

Am I correct in understanding that with the asset pipeline, these callouts aren't required in the view? 我理解资产视图不需要这些标注是正确的吗? Shouldn't all the CSS and JS be precompiled in application.css and application.js? 难道所有CSS和JS都不应该预先编译在application.css和application.js中吗?

The issue was that I had brought over all CSS and JSS files that were included with the template, but the folder also contained CSS and JS that was not required, and some of these files caused conflicts when being loaded in the asset pipeline. 问题是我已经带走了模板中包含的所有CSS和JSS文件,但是该文件夹还包含了不需要的CSS和JS,并且其中一些文件在资产管道中加载时引起冲突。 Once I pruned out all files that weren't required, all worked as expected. 删除所有不需要的文件后,所有文件均按预期工作。

As a summary: Move all required CSS files to assets/stylesheets Move all required JS files to assets/javascripts 总结:将所有必需的CSS文件移动到资产/样式表将所有必需的JS文件移动到资产/ javascript

Explicitly include/require each of the CSS/JS files in their respective application.css and application.js files. 在各自的application.css和application.js文件中明确包含/要求每个CSS / JS文件。

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

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