为什么 rails 需要 JavaScript 运行时?

编程入门 行业动态 更新时间:2024-10-24 00:32:30
本文介绍了为什么 rails 需要 JavaScript 运行时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在我的 Ubuntu Linux Box 上安装 rails(v3) &安装失败,抱怨缺少 javascript 运行时.我做了一些查找&事实证明,rails 需要在其运行的平台上安装一个 javascript 运行时.

I was installing rails(v3) on my Ubuntu Linux Box & the install failed complaining of missing javascript runtime. I did some lookup & it turns out that rails require a javascript runtime to be installed on the platform its running.

虽然,默认情况下,Windows 已与 jscript 捆绑在一起.我的 Ubuntu 盒子没有 js 运行时 &我通过安装 node.js(V8) 解决了这个问题.

While, Windows has come bundled with jscript by default. My Ubuntu box didn't have a js runtime & I fixed the issue by installing node.js(V8).

AFAIK,需要一个 js 运行时来执行 javascript 代码 &rails 只是一个嵌入了 javascript 的 Web 框架.Javascript 文件仅在客户端计算机上运行.

AFAIK, a js runtime is required to execute javascript code & rails is just a web framework in which javascript are embedded. Javascript files run only on client machines.

所以,为什么 Rails 需要 JavaScript 运行时?

推荐答案

查看 Rails Asset Pipeline.它对 JavaScript(和 CSS)文件做了一些奇特的事情.值得注意的是:

Look into the Rails Asset Pipeline. It does fancy stuff with JavaScript (and CSS) files. Notably:

  • 它将 CoffeeScript 转换为 JavaScript
  • 它将所有 javascript 文件合二为一
  • 它缩小了那个文件
  • JavaScript 运行时用于缩小.

    The JavaScript runtime is used for minification.

    更多推荐

    为什么 rails 需要 JavaScript 运行时?

    本文发布于:2023-10-31 04:59:35,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1545074.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:rails   JavaScript

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!