Thank you! That is useful information. I'm going to spend some time with the YUI documentation.
Am 07.02.2012 07:27, schrieb Joe Developer: > Here is what I do: > > 1. Leverage the YUI3 module > system: http://yuilibrary.com/yui/docs/yui/yui-loader-ext.html > 2. Define my own modules within those conventions. > 3. Use a combo handler: https://github.com/rgrove/combohandler I use a > slightly modified one which runs the resulting file through uglify and > caches the result. > > Why? > 1. Because I find YUI3 awesome and leverage it anyway, it has an > ecosystem which includes profiling, tests, doc generation, build tools > - and then everything else you might expect from a modern js lib / > framework, plus excellent documentation. > > 2. Because it is flexible and offers a number of advantages; I can > choose to hand-roll the dependency hierarchy while sketching it out, > then move on to automating it from build tools. I can choose if I want > to load the minified, debug instrumented or plain raw version of a > given file, I can even choose to load the tests for it alongside. > > 3. The combo loader system is smart enough to only load what is > actually needed on a given page, if a module is already on the page it > doesn't get loaded twice, I'm not stuck with a monolithic file ( > though I can choose to go that path in practice if it has actual > benefit for the situation ), I can *still* choose what flavor the > module that I wan't to load, on the fly, in production. > > It ends up something like: <script charset="utf-8" > src="/js/?/yui3/build/classnamemanager/classnamemanager-min.js&yui3/build/oop/oop-min.js&yui3/build/event-custom-base/event-custom-base-min.js&yui3/build/dom-core/dom-core-min.js&yui3/build/dom-base/dom-base-min.js > <http://dating.datingvip.dev:3000/js/?/yui3/build/classnamemanager/classnamemanager-min.js&yui3/build/oop/oop-min.js&yui3/build/event-custom-base/event-custom-base-min.js&yui3/build/dom-core/dom-core-min.js&yui3/build/dom-base/dom-base-min.js&yui3/build/selector-native/selector-native-min.js&yui3/build/selector/selector-min.js&yui3/build/node-core/node-core-min.js&yui3/build/node-base/node-base-min.js&yui3/build/event-base/event-base-min.js&yui3/build/event-delegate/event-delegate-min.js&yui3/build/node-event-delegate/node-event-delegate-min.js&yui3/build/array-extras/array-extras-min.js&yui3/build/attribute-core/attribute-core-min.js&yui3/build/base-core/base-core-min.js&yui3/build/event-custom-complex/event-custom-complex-min.js&yui3/build/attribute-events/attribute-events-min.js&yui3/build/attribute-extras/attribute-extras-min.js&yui3/build/attribute-base/attribute-base-min.js&yui3/build/base-base/base-base-min.js&yui3/build/base-build/base-build-min.js&yui3/build/history-base/history-base-min.js&yui3/build/event-synthetic/event-synthetic-min.js&yui3/build/history-html5/history-html5-min.js&yui3/build/history-hash/history-hash-min.js&yui3/build/history-hash-ie/history-hash-ie-min.js&yui3/build/router/router-min.js&yui3/build/pjax-base/pjax-base-min.js&yui3/build/view/view-min.js&yui3/build/app-base/app-base-min.js&yui3/build/escape/escape-min.js&yui3/build/handlebars-base/handlebars-base-min.js&yui3/build/handlebars-compiler/handlebars-compiler-min.js&yui3/build/event-key/event-key-min.js&yui3/build/dom-style/dom-style-min.js&yui3/build/node-style/node-style-min.js&yui3/build/transition/transition-min.js&yui3/build/cookie/cookie-min.js&yui3/build/intl/intl-min.js>" > async > </script> > > You could fairly easily do your jslinting as part of the build > process for individual files, or pull out predefined 'monolithic' > files from the combohandler where you then do the jslinting in that > part of the stack. > > Preloading / lazyloading ability is built-in. > > See: https://github.com/ericf/photosnear.me for a full-app example of > how it can be leveraged. > > > On Tue, Feb 7, 2012 at 12:27 PM, Phoscur <[email protected] > <mailto:[email protected]>> wrote: > > Splitting this from Build tool > > <https://groups.google.com/group/nodejs/browse_thread/thread/9814da6a8873db2f/fdfaefa8ca5db7aa>. > > > What I want: > -given entry.js, the tool has to resolve it's dependencies > inspecting require, recursivly including all relevant files > -conviently do jslint/hint checks as codestrings are already loaded > -possibility to minify for production > -filewatching and possibly caching > > To sum up for now: > -browserify <https://github.com/substack/node-browserify>: still > the mightiest for this task I've seen. Does basically all > mentionend above. But it's "just works(TM)" just won't work for > me. I keep running into bugs or bad documentation. > -browserbuild <https://github.com/LearnBoost/browserbuild>: KISS > implementation, combining all available source files and a simple > browserside require() replacement > -pakmanager <https://github.com/coolaj86/node-pakmanager>: like > browserbuild, but with ender.js require() implementation. > The last two don't satisfy my needs. > > Lazy- or Preload modules: > Also I noticed that browserify and browserbuild use lazy module > loading. So the source of each file is wrapped in a function which > is invoked the first time a module is required. I had implemented > this diffrently before: I just wrapped a closure around each file > source to execute when it's loaded. I think it's better to preload > all libraries and prototypes like I did, although I'm not sure if > this would have impact on the responsiveness of the interface. > Better a long load in the beginning that lags in the first > minutes. The algorithm for preloading addintionally has to include > some sorting to execute the files in the right order. > > regards, > Ph > > > > I wrote: >> Yeah, of course. But browserify does this better as anything else, and >> it's IMO the most important part of the JavaScript build process. So a >> lot of focus should go on this and every single nodejs build tool should >> support it by default. >> >> Just specifying one file to start this assembly and then adding all >> required files and modules recursivly seems to be the right approch for >> me. Right? >> Running that through jslint/hint and running tests aswell as diffrent >> dev/production versions seems to me all a build tool for nodejs needs to >> do. >> I don't see any build tool available which does this well enough. >> >> hij1nx wrote: >> >>> You could call Browserify a build tool, but it has a single purpose >>> (which is good!), it will bundle your commonjs for use in the browser. >>> But a lot of the tools mentioned are more general purpose software >>> build tools. >>> >>> -- >>> Paolo Fragomeni >>> Co-founder, CTO >>> Nodejitsu, Inc. >>> www.twitter.com/hij1nx <http://www.twitter.com/hij1nx> >>> www.github.com/hij1nx <http://www.github.com/hij1nx> >> > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > <mailto:[email protected]> > To unsubscribe from this group, send email to > [email protected] > <mailto:nodejs%[email protected]> > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
