简体   繁体   English

为什么Rails默认情况下不包含HTML页面底部的Javascript文件?

[英]Why Rails doesn't include the Javascript files at the bottom of the HTML page by default?

I read here that it is better to include Javascript files at the bottom of the HTML page. 在这里读到,最好在HTML页面的底部包含Javascript文件。

Why Ruby on Rails doesn't do so by default ? 为什么Ruby on Rails默认不这样做?

I would guess that Rails includes your application.js in the <head> by default because it assumes you'll be minimizing things via the asset pipeline. 我猜想Rails默认包含你的application.js<head> ,因为它假设你将通过资产管道最小化事物。 There's no need to worry about where your script is included if it's a single external file being loaded in parallel by a single HTTP request. 如果单个HTTP请求并行加载单个外部文件,则无需担心脚本的位置。

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

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