Creating a single .js file for deployment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating a single .js file for deployment

R. Tyler Croy
I've seen this topic come up a couple times, but I don't think I've seen any
definitive solution
posted.

I've tried the route of combining all my Foo.deploy.js, Bar.deploy.js into a
single .js file, and then including that in the loadAmber() call. This /seems/
to work reasonably well, but the majority of the download size still comes from
Amber internals.

In my application, the worst offenders in size are:

    * 200K - jQuery UI
    * 95K  - Kernel-Collections
    * 90K  - jQuery
    * 87K  - Kernel-Objects
    * 50K  - Canvas
    * 40K  - MyApp
    * 20K  - Kernel-Classes

I can't do *too* much about the size of jQuery UI, but I can do a lot about the
size of the Amber core, and the number of HTTP requests needed to fetch them.
The only problem is I cannot figure out how to tell Amber not to auto-matically
fetch Kernel-Objects.deploy.js, etc.


Has anybody managed to package their entire Amber javascript into a single .js
file successfully?

- R. Tyler Croy
--------------------------------------
    Code: http://github.com/rtyler
 Chatter: http://twitter.com/agentdero
          [hidden email]

attachment0 (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Creating a single .js file for deployment

Vicnet-2
Hello,

There is a amber.js file inside REPL.
Is it what you search ?

What is REPL ?

a+
Vincent

On 21 mar, 12:04, "R. Tyler Croy" <[hidden email]> wrote:

> I've seen this topic come up a couple times, but I don't think I've seen any
> definitive solution
> posted.
>
> I've tried the route of combining all my Foo.deploy.js, Bar.deploy.js into a
> single .js file, and then including that in the loadAmber() call. This /seems/
> to work reasonably well, but the majority of the download size still comes from
> Amber internals.
>
> In my application, the worst offenders in size are:
>
>     * 200K - jQuery UI
>     * 95K  - Kernel-Collections
>     * 90K  - jQuery
>     * 87K  - Kernel-Objects
>     * 50K  - Canvas
>     * 40K  - MyApp
>     * 20K  - Kernel-Classes
>
> I can't do *too* much about the size of jQuery UI, but I can do a lot about the
> size of the Amber core, and the number of HTTP requests needed to fetch them.
> The only problem is I cannot figure out how to tell Amber not to auto-matically
> fetch Kernel-Objects.deploy.js, etc.
>
> Has anybody managed to package their entire Amber javascript into a single .js
> file successfully?
>
> - R. Tyler Croy
> --------------------------------------
>     Code:http://github.com/rtyler
>  Chatter:http://twitter.com/agentdero
>           [hidden email]
>
>  application_pgp-signature_part
> < 1 000AfficherTélécharger
Reply | Threaded
Open this post in threaded view
|

Re: Creating a single .js file for deployment

Bernat Romagosa
http://en.wikipedia.org/wiki/REPL

Basically, a one-line-at-a-time evaluator.

2012/3/28 Vicnet <[hidden email]>
Hello,

There is a amber.js file inside REPL.
Is it what you search ?

What is REPL ?

a+
Vincent

On 21 mar, 12:04, "R. Tyler Croy" <[hidden email]> wrote:
> I've seen this topic come up a couple times, but I don't think I've seen any
> definitive solution
> posted.
>
> I've tried the route of combining all my Foo.deploy.js, Bar.deploy.js into a
> single .js file, and then including that in the loadAmber() call. This /seems/
> to work reasonably well, but the majority of the download size still comes from
> Amber internals.
>
> In my application, the worst offenders in size are:
>
>     * 200K - jQuery UI
>     * 95K  - Kernel-Collections
>     * 90K  - jQuery
>     * 87K  - Kernel-Objects
>     * 50K  - Canvas
>     * 40K  - MyApp
>     * 20K  - Kernel-Classes
>
> I can't do *too* much about the size of jQuery UI, but I can do a lot about the
> size of the Amber core, and the number of HTTP requests needed to fetch them.
> The only problem is I cannot figure out how to tell Amber not to auto-matically
> fetch Kernel-Objects.deploy.js, etc.
>
> Has anybody managed to package their entire Amber javascript into a single .js
> file successfully?
>
> - R. Tyler Croy
> --------------------------------------
>     Code:http://github.com/rtyler
>  Chatter:http://twitter.com/agentdero
>           [hidden email]
>
>  application_pgp-signature_part
> < 1 000AfficherTélécharger



--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Creating a single .js file for deployment

JohnnyT
In reply to this post by R. Tyler Croy
Hello -

The Amber compiler can do quite a bit of stuff:

http://github.com/NicolasPetton/amber/blob/master/bin/amberc#L18-90

This command will compile jQuery and the listed packages and generate
amber-deploy.js:

   ./bin/amberc -l js/lib/jQuery/jquery-1.6.4.min, Kernel-
Objects.deploy, Kernel-Classes.deploy, Kernel-Methods.deploy, Kernel-
Collections.deploy, Kernel-Exceptions.deploy, Canvas.deploy amber-
deploy

Also - you can download the Google Closure compiler
http://closure-compiler.googlecode.com/files/compiler-latest.zip and
put it in your home directory (~/compiler.jar) and then run (notice
the _-O_ option):

   ./bin/amberc -O -l js/lib/jQuery/jquery-1.6.4.min, Kernel-
Objects.deploy, Kernel-Classes.deploy, Kernel-Methods.deploy, Kernel-
Collections.deploy, Kernel-Exceptions.deploy, Canvas.deploy amber-
deploy

Then in your html you can just put:

   <script src='amber-deploy.js'></script>



JohnnyT

On Mar 21, 4:04 am, "R. Tyler Croy" <[hidden email]> wrote:

> I've seen this topic come up a couple times, but I don't think I've seen any
> definitive solution
> posted.
>
> I've tried the route of combining all my Foo.deploy.js, Bar.deploy.js into a
> single .js file, and then including that in the loadAmber() call. This /seems/
> to work reasonably well, but the majority of the download size still comes from
> Amber internals.
>
> In my application, the worst offenders in size are:
>
>     * 200K - jQuery UI
>     * 95K  - Kernel-Collections
>     * 90K  - jQuery
>     * 87K  - Kernel-Objects
>     * 50K  - Canvas
>     * 40K  - MyApp
>     * 20K  - Kernel-Classes
>
> I can't do *too* much about the size of jQuery UI, but I can do a lot about the
> size of the Amber core, and the number of HTTP requests needed to fetch them.
> The only problem is I cannot figure out how to tell Amber not to auto-matically
> fetch Kernel-Objects.deploy.js, etc.
>
> Has anybody managed to package their entire Amber javascript into a single .js
> file successfully?
>
> - R. Tyler Croy
> --------------------------------------
>     Code:http://github.com/rtyler
>  Chatter:http://twitter.com/agentdero
>           [hidden email]
>
>  application_pgp-signature_part
> < 1KViewDownload