Projects:Source Maps/Specs
Functional Requirements
The main goal of this project is to keep the minimized JavaScript generated files (for ERP and Retail) as are right now, adding the possibility of have JavaScript client-side code readable and debuggable without impacting performance.
To know more about JavaScript Source Maps, see here.
We plan to use the Google Closure Compiler to parse and minimize the static resources, and to generate the source map needed for this functionality to work. More information about the compiler can be found here.
Technical Specs
The main change that needs to be done is to include the Closure compiler in Openbravo, and to modify the static resources generation to use this compiler and generate the map, which will then be used automatically by the browser.
Specific technical tasks to be implemented
- The StaticResourceComponent will be modified to use the Closure Compiler to minimize and generate the source map. The JSCompressor library, which was previously used to minimize the code, will no longer be used and will be removed from Openbravo.
- If the system is in development, the code will not be minimized, preserving previous behavior. The main reason for this is that the closure compiler adds some seconds to process the static resources file, and while this is not a big problem in production environments because this only happens once after Tomcat is started, in development environments this happens every time the file is requested, and this would a bit of overhead for developers.
- The Closure compiler itself is quite big, mainly due to the fact that several external libraries are included in the .jar. The project will be recompiled without these libraries, to reduce its size and to prevent duplicity of libraries in Openbravo.
- The mobile libraries are currently served minimized or not minimized directly, with some pre-generated files being served in one case or the other. We will modify these pre-generated files to include a map for them, and we will also modify the documentation explaining how to generate this, to add information about how to generate and include the map.