Answer the question
In order to leave comments, you need to log in
Should I use RequireJS or use another builder?
I am developing one project, Marionette JS was chosen as the framework, since the development is already approaching the final stage, the issue of building the project has become very acute.
My first decision was to use Grunt to build all the JS files, the templates would be loaded by AJAX as needed.
Then I started looking in the direction of RequireJS, at first the solution seemed optimal, but problems immediately appeared
: .
2. If you use the built-in r.js optimizer, then the assembly of the project with all the templates can exceed 500Kb, and probably even more in the future.
Now the question itself:
There are 8-10 independent modules in the application, while different modules are available to different users. How I would like to organize everything:
1.Create one minimized file in which to collect all the libraries and common files.
2.Create separate files for each module, which also include templates.
3.Load these files as you call the module.
Prompt as it is all to organize and what to use.
Also I think to look towards LMD.
Thank you very much in advance.
Answer the question
In order to leave comments, you need to log in
400Kb will shrink with gzip and it will be even less. If there is no sharpening for mobile phones, then maybe you should not worry?
Try loading templates on masterpage. Then at the time of starting js you will already have all the templates. You obviously have some heavy libraries. For example jquery. They can not be collected, but loaded from a CDN.
Further, since you have 8-10 modules, it is better to assemble them separately from each other.
It's strange, on the contrary, everything loads very quickly in an unassembled form, although there are more than 150 modules. The assembly, yes, is quite long, but it is done in the background. Maybe your server is able to give only one file at a time?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question