0

I want use requirejs in a new project but I am not sure about. I have two modules and one of them has a dependency with one other module. well, that works fine.

I have tried to minify the modules but the result are a problem. If I minify and concate all the file to one - it works but where is the advantage to load only necessary modules? at the end I have one big file, load "all" the modules, so there is no advantage - just the right order in case of dependencies.

as example:

page (a) has a gallery so would like to load a general module (makes layer...) and a module for a gallery.

page (b) has no gallery would just load the general module


To load the module for a gallery I could check the html for a specific class or id... but if I concate all the files, I would load in both cases all. If I do not concate, I can not really minify the files.

Can someone help me with this issue or explain where the advantages really are?

roberrrt-s
  • 7,914
  • 2
  • 46
  • 57
andreas
  • 21
  • 2

1 Answers1

0

It's best to load all the js the user will mostly use for your page. So best to load all scripts into one file. Doing this the cache will give the stronger benefit on each page.

Medda86
  • 1,582
  • 1
  • 12
  • 19