Add closure after concatenating files or keep one for each separate file?

Posted by sdespolit on Programmers See other posts from Programmers or by sdespolit
Published on 2012-03-26T12:58:09Z Indexed on 2012/03/26 17:38 UTC
Read the original article Hit count: 146

At the moment every javasrcipt file in our project includes closure wrapper. Before deploying all files are concatenated and minimized.

And i'm asking myself, do we really need all that closures OR one closure added after concatenation will do the job.

I can see only one reason not to do that - the variable we are sharing between files will get in the global namespace. But there is no conflict so is don't see any problem.

The real question is what other cons may be? Or more generally what approach is better - one closure or many?

© Programmers or respective owner

Related posts about web-development

Related posts about JavaScript