Higher and lower languages
High-level language High-level languages are programming languages designed to be easier for humans to understand than machines. Also, “high-level” does not mean an excellent language, but means that it is possible to describe elements unique to the model or OS with a high degree of abstraction, and many languages used for developing application software etc. Is classified as a high-level language, so the expression “high-level” is used.
Lower language A language that is easy for a machine to recognize is called a low-level language. “Lower” does not mean inferior language, but rather closer to hardware We use the term “lower” to do this.
To display the file in the browser, the machine recognizes it after developing it in a high-level language. It is necessary to translate into a lower level language that can be done, and that translation is called compilation.
The process of translating a programming language so that it can be understood by a working machine. Compilation is called a compiler (an opportunity-friendly programming language) It is done programmatically. If there is a language that cannot be recognized by the compiler, it must be pre-compiled into a language that can be recognized beforehand.
Pre-compilation that allows the compiler to translate languages that it cannot translate. Or, it refers to the pre-processing required for the main processing. In other words, pre-compilation is the compilation that should be done before compilation and main processing.
For example, a web application precompiles a file written in a high-level language and passes it to the browser so that the web browser can do the main thing of reading and displaying a static file.
As a method for performing such pre-compilation, there is a mechanism called asset pipeline.
The processing of the asset pipeline is carried out according to the flow of “1) pre-compilation”, “2 connection”, “3 compression”, “4 arrangement” **.
After precompiling and concatenating multiple static files, compress and lighten it and place it in the
public directory so that it can be passed to the browser.
Modules allow you to split a large number of functions into multiple files, and you can combine the separated functions into a single file and work fine. However, because it is divided into multiple parts, a dependency is created, and there is a problem that it can not operate properly if there is a module that can not be loaded.
The solution to this problem is the module bundler, which manages the modules by bundling them together. In recent years, webpack has become the mainstream among module bundlers.
|Entry||Decide which file should be used as the reference (entry point) to resolve dependencies|
|Output||Specify where and with what name the files that are collected by webpack and are used as the entry point|
|Plugins||Introduce and extend (plug-in) tasks such as compression that cannot be executed by the loader other than putting together files.|
Although webpack can be introduced to Rails and command operation is possible, there is a gem called Webpacker that simplifies the setting because the description of the configuration file is somewhat difficult.