Why does rails require JavaScript Runtime?

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

  1. It converts CoffeeScript into JavaScript
  2. It combines all javascript files into one
  3. It minifies that file

The JavaScript runtime is used for minification.


Railsguides says it has to do with compression:

You will need an ExecJS supported runtime in order to use uglifier. If you are using Mac OS X or Windows you have a JavaScript runtime installed in your operating system. Check the ExecJS documentation for information on all of the supported JavaScript runtimes.

http://guides.rubyonrails.org/asset_pipeline.html#javascript-compression

I thought I had seen Rails actually check the validity of both the stylesheets and the javascript in your app, but maybe it was just SASS prepreocessing.