1

I have decided to start using RequireJS for projects and I am confused on when it is best to use RequireJS and when it is not.

For example, I have a small site that uses around 4-6 scripts on each page. I am currently concatenating all scripts into one minified script. Would it make sense to not do this and instead load them with RequireJS?

I understand using RequireJS for large web apps, but what I am in the air about is whether or not it makes sense for smaller sites as well.

Patrick Burtchaell
  • 4,112
  • 1
  • 14
  • 25

1 Answers1

1

I started using requirejs very recently.

One of the main advantages I have noticed is the clear separation of scopes - I had a habit of muddying the global scope at times.

Having clearly isolated modules and their dependencies explicitly listed makes for reusable and manageable code.

Also minification is handled simply with requirejs making the transition from dev code to production code simple.

I now try to make sure that all my javascript is modular no matter how small the project, I think this has been a wise decision.

Liam
  • 27,717
  • 28
  • 128
  • 190
Joe
  • 1,455
  • 2
  • 19
  • 36