Re: [nodejs] bundle javascript for reuse in the browser

2012-02-10 Thread Jann Horn
2012/2/9 Taka Kojima : > This is not scalable though. If my entire site has 200kb of JS throughout > the entire site, requiring users to download all 200kb upon page load is > well, non-sensical. That's much. Could you upload that somewhere? Might be a good sample for looking for optimization oppo

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-09 Thread Adam Crabtree
The main issue here is that we need to stop viewing IO in the browser as equivalent module loading. IO in the browser is more along the lines of installation. Doing an asynchronous require in the browser, is more akin to: require('child_process').exec('npm install moduleA', function(err) { var m

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-09 Thread Phoscur
Then it depends on what you want to build. I want a fat client WebApplication. Maybe you don't want 200kb JavaScript on your frontpage. But for the WebApplication I trade small loads on each click against a longer loading time on initialisation. Am 09.02.2012 23:45, schrieb Taka Kojima: > I under

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-09 Thread Taka Kojima
I understand how browserify works, maybe I didn't clarify well enough. Yes, you don't have to inject moduleZ into moduleA, B and C if you put them all in the same file and load that js file upfront. This is not scalable though. If my entire site has 200kb of JS throughout the entire site, requiri

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-09 Thread Phoscur
I think you haven't actually understood how browserify/browserbuild work: 1. load source files 2. wrap a function around them 3. concat all of them together and add a custom require() emulating node's require 4. instead of many script tags, insert one with the big file Now when moduleA requires mo

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-09 Thread Taka Kojima
It's not really AJAX, it's just loading in the js files by injecting

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-09 Thread Phoscur
Then do not load code via ajax. Am 09.02.2012 22:18, schrieb Mark Hahn: > > What exactly the problem with using node's synchronous approach in > the browser? > > Node loads the module quickly from the disk. Loading over an ajax > request is much slower. > > -- > Job Board: http://jobs.nodejs.

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-09 Thread Mark Hahn
> What exactly the problem with using node's synchronous approach in the browser? Node loads the module quickly from the disk. Loading over an ajax request is much slower. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidel

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-09 Thread Taka Kojima
I should have lead with the first paragraph, I realize this doesn't solve any of your needs/requirements, Mainly I was just trying to say (with a shameless self-plug) that trying to get node modules to work in the browser, is not the right approach. It should be getting browser modules to work in

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-09 Thread Taka Kojima
I wrote a library for this. It's small (3.8kb) and has a cli for building. http://www.screenr.com/wOas https://github.com/gigafied/minion It allows you to develop locally without having to build every time you make changes, it handles the dependency loading asynchronously. When you are ready to

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-09 Thread Adam Crabtree
Honestly, all browser-side modules should adhere whether initially or through a build process to the AMD pattern as this is where the current momentum is and it is a module definition pattern first and foremost built for the browser environment. Also, this pattern is very compatible with node modul

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-07 Thread Azer Koçulu
I would like to mention OneJS (http://github.com/azer/onejs) in this topic. It's a new one, creates stand-alone JavaScript files that can be run on all JS platforms, from NodeJS packages. Here is a usage example; $ onejs build package.json build/standalone.js (an example output: http://multiplayer

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-07 Thread Phoscur
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

Re: [nodejs] bundle javascript for reuse in the browser

2012-02-06 Thread 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

[nodejs] bundle javascript for reuse in the browser

2012-02-06 Thread Phoscur
Splitting this from Build tool. 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 c