Html 在Ruby中显示Processing.pde文件?
我对Ruby和Processing都相当陌生,但我有一个Ruby内置的页面,我想知道如何在该页面上显示我的Processing.PDE文件。我在网上看到你需要Processing.js 我从[processingjs.org][1]复制了processing.js的代码,并将其放在app/assets/javascripts中名为processing.js的文件中 我在app/assets/images/data中保存了一个名为butts.pde的.pde文件 我是否在头中正确调用脚本,在正文中正确调用文件?当我试图查看页面时,我什么也看不到Html 在Ruby中显示Processing.pde文件?,html,ruby,rubygems,processing,processing.js,Html,Ruby,Rubygems,Processing,Processing.js,我对Ruby和Processing都相当陌生,但我有一个Ruby内置的页面,我想知道如何在该页面上显示我的Processing.PDE文件。我在网上看到你需要Processing.js 我从[processingjs.org][1]复制了processing.js的代码,并将其放在app/assets/javascripts中名为processing.js的文件中 我在app/assets/images/data中保存了一个名为butts.pde的.pde文件 我是否在头中正确调用脚本,在正文中
<head>
<title>Hello</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="assets/javascripts/processing.js"></script>
</head>
浏览器控制台的内容如下:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/assest/javascripts/processing.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/assets/images/data/butters.pde
Uncaught Processing.js: Unable to load pjs sketch files: /assets/images/data/butters.pde ==> Invalid XHR status 404
很抱歉。谢谢你的提示。我的问题,真的吗?处理1.0.0?目前的版本是1.4.8,1.0.0是几年前的版本。也就是说,检查浏览器的dev工具控制台,看看它是在点击404还是链接。很可能您试图从错误的目录解析文件。是的,processing 1.0.0是我能找到的唯一processing.js ruby gem。我知道它很古老,但我不知道还能做什么。我在学校里找到的唯一的教程。感谢您的提示不要使用gem安装程序,只需从网站抓取processing.js,将其作为普通脚本添加到
中,然后如果您生成一个带有
的页面,它将自动加载到页面上即可。@Mike'Pomax'Kamermans我已经编辑了我的问题-不再使用gem安装程序,我试图用网站上的processing.js来完成这项工作,但我没有得到它…更新后的代码有什么问题吗?谢谢
Started GET "/assets/images/data/butters.pde" for 127.0.0.1 at 2014-09-23 14:55:18 -0400
ActionController::RoutingError (No route matches [GET] "/assets/images/data/butters.pde"):
actionpack (4.1.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/assest/javascripts/processing.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/assets/images/data/butters.pde
Uncaught Processing.js: Unable to load pjs sketch files: /assets/images/data/butters.pde ==> Invalid XHR status 404