So I made an initial stab at this effort, similar to the way I had
outlined, and with requirejs support similar to the asynjs library
mentioned. I also added grunt as a build system which should give us more
flexibility.

You can check it out at:
https://github.com/seancolyer/openpgpjs/tree/refactor/resources

I also added an example using require.js.  I haven't fully tested, but I
think this is the direction that best helps modularize openpgpjs.

Sean


On Tue, Mar 26, 2013 at 5:13 AM, Fabio Pietrosanti (naif) <
[email protected]> wrote:

>  On 3/26/13 4:58 AM, Sean Colyer wrote:
> > I agree it would be good to move out of the global space. We can take a
> couple of different paths to accomplish this.
> >
> > Option one -- Use augmentation to maintain file-by-file independence. We
> could presumably use a form like:
> > var openpgp = (function(context) { .. })(openpgp || {});
> > in each of our js files to build the openpgp object up ad-hoc.  I think
> the major downside to this is that references that are now to our more
> static calls (like in crypto/cfb folders:
> openpgp_crypto_generateSessionKey) will all have to be update, i.e.:
> openpgp.openpgp_crypto_generateSessionKey
> >
> > Option two -- Concatenate all the files and then wrap the entire thing.
> This is similar to what jQuery does with intro and outro (
> https://github.com/jquery/jquery/tree/master/src). We have to make sure
> the files are built in the same order, but I think it is the path of least
> resistance. We could avoid some of the updating associated with option one.
> It could also be worthwhile here to switch to a build system closer to what
> jQuery uses with node/grunt to accomplish some of these tasks.
> >
> > I think Option two is what we are better positioned for and also a good
> path forward.
> >
> > Thoughts?
>
> I think that it would be nice also to think about setting up some kind of
> "automated" (like Continuous Integration) system that on each commit, with
> a github posthook, automatically "build" the OpenPGP.js" library with a
> compressed/optimized single .js code.
>
> That way it would be easier for anyone willing to use it in an efficient
> way, to just embedd it already compressed/optimized?
>
> Fabio
>
>
> _______________________________________________
>
> http://openpgpjs.org
>
>
_______________________________________________

http://openpgpjs.org

Reply via email to