How can I easily maintain a cross-file JavaScript Library Development Environment

孤街浪徒 提交于 2019-12-04 10:49:56

The jQuery github has a similar setup to the one you speak of. There is even a Makefile / ant build.xml that use the google closure complier.

The basic concept is to develop all your stuff in separate files, then use cat (or something similar) to put all the files together.

 cat intro.js core.js featureOne.js featureTwo.js featureThree.js outro.js > build/script.js

The code inside intro.js and outro.js from jQuery:

 // intro.js
 (function(window, undefined) {

 // outro.js
 })(window);

Take a look at how this library is built
http://github.com/oyvindkinsey/easyXDM

The files are separated, but merged together, placed into a closure, and run through jslint by the ant script (build.xml).

The ant script also does conditional 'compilation', string replacements and minification.

I recommend that you split your code base into AMD/RequireJS-style modules.

The AMD format seems to meet most of your requirements, and is rapidly becoming a de facto standard.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!