Ruby on rails 包括应用程序中的所有javascript文件,Rails 3.2.11中的特定文件夹除外

Ruby on rails 包括应用程序中的所有javascript文件,Rails 3.2.11中的特定文件夹除外,ruby-on-rails,Ruby On Rails,我想从我的application.html.haml 我不想包含在布局中的文件夹是mobilefolder 以下是我的布局: %html(lang="en") %head %meta(charset="utf-8") %meta(http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1") %meta(name="viewport" content="width=device-width, initial-scale

我想从我的
application.html.haml

我不想包含在布局中的文件夹是
mobile
folder

以下是我的布局:

%html(lang="en")
  %head
    %meta(charset="utf-8")
    %meta(http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1")
    %meta(name="viewport" content="width=device-width, initial-scale=1.0")
    %title= content_for?(:title) ? yield(:title) : @user.name ? 'Niche | ' + @user.name : 'Niche'
    = csrf_meta_tags
    = analytics_init if Rails.env.production?
    / Le HTML5 shim, for IE6-8 support of HTML elements
    /[if lt IE 9]
      = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"
    = stylesheet_link_tag "application", :media => "all"

  %body#profile

    %section.persist-area
      %header.global.profile
        %div.container
          %a.brand.pull-left{ :href => root_path }
            .logo-niche


          %nav.pull-right
            = render 'layouts/menu'

      .container-fluid#main
        = yield :profile

      /
        Javascripts
        \==================================================
      / Placed at the end of the document so the pages load faster
      = javascript_include_tag "application"
      = yield :javascript
在这个片段中,我得到了所有JS:

= javascript_include_tag "application"
但是我想得到所有的JS,除了名为
mobile

我尝试了以下解决方法,但没有成功:

= javascript_include_tag "application", except: "mobile"
对不起,那只是一个猜测。根据文档,也没有
javascript\u exclude\u标记

有什么想法吗?谢谢


PS:我的手机有不同的布局,所以我真的想在桌面视图中排除该文件夹。在我的桌面视图中有很多冲突。

在application.js中更改

//= require_tree


因此,app/assets/javascripts/*文件将包括在内,而app/assets/javascripts/mobile/*将不包括在内。

application.js中的更改

//= require_tree


因此,app/assets/javascripts/*文件将包括在内,而app/assets/javascripts/mobile/*将不包括在内。

那么。。。不需要其他文件夹(例如,我还有一个lib文件夹)?有没有办法只排除一个文件夹?谢谢你的回复。我会做“/=require_-tree./usful”并且在usful下,我需要的所有文件夹和文件都会保留。“/mobile”将被排除在外。在这里,我假设我的“app/assets/javascripts”、“mobile and usiver”中有两个文件夹,谢谢你的回答,但我也使用了
stub
。如果其他人遇到这个问题,请提供更多信息:那么。。。不需要其他文件夹(例如,我还有一个lib文件夹)?有没有办法只排除一个文件夹?谢谢你的回复。我会做“/=require_-tree./usful”并且在usful下,我需要的所有文件夹和文件都会保留。“/mobile”将被排除在外。在这里,我假设我的“app/assets/javascripts”、“mobile and usiver”中有两个文件夹,谢谢你的回答,但我也使用了
stub
。如果其他人遇到此问题,请提供更多信息:
//= require_tree ./useful