Organizational Research By

Surprising Reserch Topic

what is a javascript pre compiled library

what is a javascript pre compiled library  using -'javascript,magento,precompiled'

I'm learning how to use Magento e-commerce system, I'm reading its documentation but I don't understand some term, a "pre-compiled JavaScript library", what do they mean by that?, how can JavaScript code be compiled?

  The web downloader for upgrading and installing Magento without the
¬†¬†use of SSH (covered in Chapter 2). ‚ÄĘ js‚ÄĒThe core folder where all
  JavaScript code included with the installation of Magento is kept. We
  will find all pre-compiled libraries of JavaScript here.


asked Oct 13, 2015 by mannar kande
0 votes

Related Hot Questions

2 Answers

0 votes

I do not know what Magento e-commerce uses, but I know what JavaScript Compilers are.

Pre-Compiled JavaScript is not practical as the various JavaScript interpreters will have their own method of compiling. Therefore, when most people talk about Compiling JavaScript, they are usually referring Minified JavaScript.

However, the latest minifiers go way beyond. A good example is Google Closure Compiler Advanced Mode. It is related to Google Closure Library and Tools, but is well designed even when used by itself.

There is an Online Demo of Closure Compiler.

It is called a Compiler because it is more than a minifier and the name JavaScript Compiler is not used for anything else. For example: This code

function hello(name) {
  alert('Hello, ' + name);
hello('New user');

compiles to alert("Hello, New user"); in advanced mode. Single-use functions are removed, variable names are shortened, and even re-used.

It is very thorough. Simple mode assumes that there might be other JavaScript involved. in which case it would preserve the hello function. Advanced mode assumes that there is only a single JavaScript file, or that it is properly exported.

The one thing that keeps this from really being compiled is that it is not bytecode like compiled C or Java would be. It still has to be compiled at run-time like Perl.

answered Oct 13, 2015 by shikhar jain
0 votes

Magento has an configuration option in the admin at

System -> Configuration -> Developer -> JavaScript Settings

named Merged Javascript Files.

When this setting is on, Magento will take all the javascript files it knows about, "compile" them to a minified version to product smaller files sizes, and then combine all the javascript files into a single javascript file. This way, instead of opening multiple network connections to download multiple files, Magento will open a single network connection to open one file.

So, when the documentation says that folder contains the pre-compiled versions, it means that's where the individual javascript files are stored, and where the files are loaded from when Merged Javascript Files

The term compilation comes from Computer Science. A compiler takes source code, and transforms it from one language into another language.

Traditionally, it's meant taking code from a higher level language (C, .NET, Java, etc.), and transforming it into the machine code (assembly code) that's understood by the computer chip. However, the term is generic and more modern usage includes taking the source code written in one language (Javascript) and transforms it into a different form (minified javascript).

answered Oct 13, 2015 by devkumargupta