Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 简单的Ruby rack应用程序。加载所有子文件夹_Html_Ruby_Rack_Assets - Fatal编程技术网

Html 简单的Ruby rack应用程序。加载所有子文件夹

Html 简单的Ruby rack应用程序。加载所有子文件夹,html,ruby,rack,assets,Html,Ruby,Rack,Assets,我正在尝试创建带有静态页面的简单rack应用程序 我的应用程序的结构: public |-index.html |-css |-skins |-blue |-blue.css |-yellow |-yellow.css ....many more... |-js |-bootstrap |-aide |-abide.js ...many more... config.ru Gemfile

我正在尝试创建带有静态页面的简单rack应用程序

我的应用程序的结构:

public
 |-index.html
 |-css
   |-skins
     |-blue
       |-blue.css
     |-yellow
      |-yellow.css
     ....many more...
 |-js
   |-bootstrap
      |-aide
       |-abide.js
   ...many more...
config.ru
Gemfile
我的config.ru文件

use Rack::Static,
  :urls => ["/images", "/js", "/css"],
  :root => "public"
run lambda { |env|
  [
    200,
    {
      'Content-Type'  => 'text/html',
      'Cache-Control' => 'public, max-age=86400'
    },
    File.open('public/index.html', File::RDONLY)
  ]
}
问题是,在每个文件夹“js”、“css”中,我有数百个子目录和文件,不知道手动指定它们。我可以一次加载所有子文件夹吗

编辑

在上面的配置中,当我运行
rackup
并将浏览器指向
localhost:9292
时。我刚刚看到了白色屏幕加载。我认为问题可能是没有加载子目录。但在查看日志后,我发现我的资产正在无限循环中加载,这就是为什么应用程序没有响应

所有资产都加载了200个成功状态。我没有任何额外的特定配置。Gemfile是

source 'https://rubygems.org'

gem 'mail'
gem 'rack'

正确的index.html源可能是一个解决方案

要调试正在发生的事情,您可以尝试加载index.html,其中只包含一个特定的JS/Css文件和所有其他文件中的临时注释,以确保不会重复您自己


希望有帮助。

Ilya,我在本地机器上试过了,一切都很好,你能显示一些错误输出吗?嗨,CodeGroover,谢谢,我已经更新了我的问题。你能打印出相应的日志输出(pastie或github gists)吗?对不起,但我看不到你的日志中有无限循环。你能试着在index.html中只加载一个特定的JS文件和所有其他文件中的临时注释,以确保你不会重复你自己吗。保持联系。我放弃了,只是简单地使用RubyonRails公共文件夹:)
source 'https://rubygems.org'

gem 'mail'
gem 'rack'