[英]How do I completely remove all references to application.js and application.css in a Rails app?
I'm working in Rails 4.2.4 to deploy a very simple Web API. 我正在Rails 4.2.4中部署一个非常简单的Web API。 This interface does not require JavaScript or CSS, so the requests for application.js
and application.css
are just generating log spam and increasing response times. 该接口不需要JavaScript或CSS,因此对application.js
和application.css
的请求仅生成日志垃圾邮件,并增加了响应时间。 I have tried disabling assets and skipping sprockets , but the pages served by the app continue to reference application.js
and application.css
, even in my "Hello, world!" 我曾尝试禁用资产并跳过链轮 ,但该应用程序所服务的页面仍继续引用application.js
和application.css
,即使在我的“ Hello,world!”中也是如此。 controller generated from the Getting Started Guide . 根据入门指南生成的控制器。
How can I permanently disable references to these non-existent, unrequired files? 如何永久禁用对这些不存在的不需要文件的引用?
Modify your ./app/views/layouts/application.html.erb
to only have the following content: 将您的./app/views/layouts/application.html.erb
修改为仅包含以下内容:
<%= yield %>
In other words, remove the <html>
, <head>
, and <body>
tags. 换句话说,删除<html>
, <head>
和<body>
标记。 There are several other ways to achieve your objective, but this might be the easiest. 还有其他几种方法可以实现您的目标,但这可能是最简单的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.