You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rave.apache.org by "Carlucci, Tony" <ac...@mitre.org> on 2012/03/22 16:57:50 UTC

[PROPOSAL] Improvements to JavaScript

Hello Rave Developers,

Currently we have lots of duplicated JavaScript import statements <script src=""> across our JSP pages which is not ideal from a maintenance or extension perspective.  I'd like to propose (and plan to implement) the following changes to improve the code base:

(1) Move all <script src=""> into one central tag file for easier maintenance and overlaying, and import this tag on all JSP pages.  Organize Rave vs external third-party files as appropriate (same file or perhaps separate tags)

(2) As part of the build, concatenate all of the Rave javascript files into one file for improved performance and bundle it in the WAR

(3) As part of the build, also minify the concatenated file for even more improved performance and bundle it in the WAR

(4) Add a new Administrative Preference to choose which file to serve out: the non-minified file (by default for debugging), or the minified file (for performance)

Thoughts or concerns?  We've performed this design model on other applications internally to great success.  There should be minimal performance impact for serving the entire single Rave JavaScript file on all pages, especially in the best-case scenario when it is minified AND cached appropriately in the browser.

Thanks, Tony


RE: [PROPOSAL] Improvements to JavaScript

Posted by "Carlucci, Tony" <ac...@mitre.org>.
Hi Richard, please see my comment below about the portal preference.  This databse setting will allow an administrator to choose which javascript file(s) to serve out through the application.  By default, the behavior will be as it is now - serving multiple individual files - to make it easy for developers to debug.  

Which Maven plugin are you using?  I've come across a few and would like other opinions...

Thanks, Tony

>-----Original Message-----
>From: Richard Kettelerij [mailto:richardkettelerij@gmail.com]
>Sent: Thursday, March 22, 2012 5:05 PM
>To: rave-dev@incubator.apache.org
>Subject: Re: [PROPOSAL] Improvements to JavaScript
>
>I'm currently running Rave with option 3: serving all Javascript files as
>one minified file.
>
>Minification and concatenation is performed by a Maven plugin. You might
>want to consider putting such Maven plugin in a separate Maven profile
>(e.g. release) so ordinary developers don't have to deal with minified code
>when debugging.
>
>Regards,
>Richard
>
>On Thu, Mar 22, 2012 at 8:04 PM, Carlucci, Tony <ac...@mitre.org> wrote:
>
>>
>> >-----Original Message-----
>> >From: Raminderjeet Singh [mailto:raminderjsingh@gmail.com]
>> >Sent: Thursday, March 22, 2012 1:35 PM
>> >To: rave-dev@incubator.apache.org
>> >Subject: Re: [PROPOSAL] Improvements to JavaScript
>> >
>> >Yes i have seen the same while going through different files and
>> debugging.
>> >+1 for improving on this.
>> >
>> >Only concern came in my mind was concatenating to one big file. That
>makes
>> >the debugging little difficult as develop need to search trough the
>> different
>> >files to find the method. Can we do this concatenation just on
>> distribution
>> >WAR and leave the Cargo/development war without concatenation. :)
>actually
>> >4) address my concern.
>> >
>> >Now just curious to know is this admin preference handled at maven
>profile
>> >level?
>>
>> My plan is to make it a database portal preference (like the number of
>> items per page and Page title suffix) that way it can be changed runtime.
>>  This could be useful if someone is reporting client errors and an admin
>> could flip it and start debugging.
>>
>> Another alternative would be to allow 3 states instead of 2:
>> 1) serve original separate JS files
>> 2) serve concatenated un-minified single file
>> 3) serve minifed concatenated single file
>>
>> >Thanks
>> >Raminder
>> >
>> >
>> >On Mar 22, 2012, at 11:57 AM, Carlucci, Tony wrote:
>> >
>> >> Hello Rave Developers,
>> >>
>> >> Currently we have lots of duplicated JavaScript import statements
>> <script
>> >src=""> across our JSP pages which is not ideal from a maintenance or
>> >extension perspective.  I'd like to propose (and plan to implement) the
>> >following changes to improve the code base:
>> >>
>> >> (1) Move all <script src=""> into one central tag file for easier
>> maintenance
>> >and overlaying, and import this tag on all JSP pages.  Organize Rave vs
>> external
>> >third-party files as appropriate (same file or perhaps separate tags)
>> >>
>> >> (2) As part of the build, concatenate all of the Rave javascript files
>> into one
>> >file for improved performance and bundle it in the WAR
>> >>
>> >> (3) As part of the build, also minify the concatenated file for even
>> more
>> >improved performance and bundle it in the WAR
>> >>
>> >> (4) Add a new Administrative Preference to choose which file to serve
>> out:
>> >the non-minified file (by default for debugging), or the minified file
>> (for
>> >performance)
>> >>
>> >> Thoughts or concerns?  We've performed this design model on other
>> >applications internally to great success.  There should be minimal
>> performance
>> >impact for serving the entire single Rave JavaScript file on all pages,
>> especially
>> >in the best-case scenario when it is minified AND cached appropriately in
>> the
>> >browser.
>> >>
>> >> Thanks, Tony
>> >>
>>
>>

Re: [PROPOSAL] Improvements to JavaScript

Posted by Richard Kettelerij <ri...@gmail.com>.
I'm currently running Rave with option 3: serving all Javascript files as
one minified file.

Minification and concatenation is performed by a Maven plugin. You might
want to consider putting such Maven plugin in a separate Maven profile
(e.g. release) so ordinary developers don't have to deal with minified code
when debugging.

Regards,
Richard

On Thu, Mar 22, 2012 at 8:04 PM, Carlucci, Tony <ac...@mitre.org> wrote:

>
> >-----Original Message-----
> >From: Raminderjeet Singh [mailto:raminderjsingh@gmail.com]
> >Sent: Thursday, March 22, 2012 1:35 PM
> >To: rave-dev@incubator.apache.org
> >Subject: Re: [PROPOSAL] Improvements to JavaScript
> >
> >Yes i have seen the same while going through different files and
> debugging.
> >+1 for improving on this.
> >
> >Only concern came in my mind was concatenating to one big file. That makes
> >the debugging little difficult as develop need to search trough the
> different
> >files to find the method. Can we do this concatenation just on
> distribution
> >WAR and leave the Cargo/development war without concatenation. :) actually
> >4) address my concern.
> >
> >Now just curious to know is this admin preference handled at maven profile
> >level?
>
> My plan is to make it a database portal preference (like the number of
> items per page and Page title suffix) that way it can be changed runtime.
>  This could be useful if someone is reporting client errors and an admin
> could flip it and start debugging.
>
> Another alternative would be to allow 3 states instead of 2:
> 1) serve original separate JS files
> 2) serve concatenated un-minified single file
> 3) serve minifed concatenated single file
>
> >Thanks
> >Raminder
> >
> >
> >On Mar 22, 2012, at 11:57 AM, Carlucci, Tony wrote:
> >
> >> Hello Rave Developers,
> >>
> >> Currently we have lots of duplicated JavaScript import statements
> <script
> >src=""> across our JSP pages which is not ideal from a maintenance or
> >extension perspective.  I'd like to propose (and plan to implement) the
> >following changes to improve the code base:
> >>
> >> (1) Move all <script src=""> into one central tag file for easier
> maintenance
> >and overlaying, and import this tag on all JSP pages.  Organize Rave vs
> external
> >third-party files as appropriate (same file or perhaps separate tags)
> >>
> >> (2) As part of the build, concatenate all of the Rave javascript files
> into one
> >file for improved performance and bundle it in the WAR
> >>
> >> (3) As part of the build, also minify the concatenated file for even
> more
> >improved performance and bundle it in the WAR
> >>
> >> (4) Add a new Administrative Preference to choose which file to serve
> out:
> >the non-minified file (by default for debugging), or the minified file
> (for
> >performance)
> >>
> >> Thoughts or concerns?  We've performed this design model on other
> >applications internally to great success.  There should be minimal
> performance
> >impact for serving the entire single Rave JavaScript file on all pages,
> especially
> >in the best-case scenario when it is minified AND cached appropriately in
> the
> >browser.
> >>
> >> Thanks, Tony
> >>
>
>

RE: [PROPOSAL] Improvements to JavaScript

Posted by "Carlucci, Tony" <ac...@mitre.org>.
>-----Original Message-----
>From: Raminderjeet Singh [mailto:raminderjsingh@gmail.com]
>Sent: Thursday, March 22, 2012 1:35 PM
>To: rave-dev@incubator.apache.org
>Subject: Re: [PROPOSAL] Improvements to JavaScript
>
>Yes i have seen the same while going through different files and debugging.
>+1 for improving on this.
>
>Only concern came in my mind was concatenating to one big file. That makes
>the debugging little difficult as develop need to search trough the different
>files to find the method. Can we do this concatenation just on distribution
>WAR and leave the Cargo/development war without concatenation. :) actually
>4) address my concern.
>
>Now just curious to know is this admin preference handled at maven profile
>level?

My plan is to make it a database portal preference (like the number of items per page and Page title suffix) that way it can be changed runtime.  This could be useful if someone is reporting client errors and an admin could flip it and start debugging.

Another alternative would be to allow 3 states instead of 2:
1) serve original separate JS files
2) serve concatenated un-minified single file
3) serve minifed concatenated single file

>Thanks
>Raminder
>
>
>On Mar 22, 2012, at 11:57 AM, Carlucci, Tony wrote:
>
>> Hello Rave Developers,
>>
>> Currently we have lots of duplicated JavaScript import statements <script
>src=""> across our JSP pages which is not ideal from a maintenance or
>extension perspective.  I'd like to propose (and plan to implement) the
>following changes to improve the code base:
>>
>> (1) Move all <script src=""> into one central tag file for easier maintenance
>and overlaying, and import this tag on all JSP pages.  Organize Rave vs external
>third-party files as appropriate (same file or perhaps separate tags)
>>
>> (2) As part of the build, concatenate all of the Rave javascript files into one
>file for improved performance and bundle it in the WAR
>>
>> (3) As part of the build, also minify the concatenated file for even more
>improved performance and bundle it in the WAR
>>
>> (4) Add a new Administrative Preference to choose which file to serve out:
>the non-minified file (by default for debugging), or the minified file (for
>performance)
>>
>> Thoughts or concerns?  We've performed this design model on other
>applications internally to great success.  There should be minimal performance
>impact for serving the entire single Rave JavaScript file on all pages, especially
>in the best-case scenario when it is minified AND cached appropriately in the
>browser.
>>
>> Thanks, Tony
>>


Re: [PROPOSAL] Improvements to JavaScript

Posted by Raminderjeet Singh <ra...@gmail.com>.
Yes i have seen the same while going through different files and debugging. +1 for improving on this. 

Only concern came in my mind was concatenating to one big file. That makes the debugging little difficult as develop need to search trough the different files to find the method. Can we do this concatenation just on distribution WAR and leave the Cargo/development war without concatenation. :) actually 4) address my concern. 

Now just curious to know is this admin preference handled at maven profile level?

Thanks
Raminder 


On Mar 22, 2012, at 11:57 AM, Carlucci, Tony wrote:

> Hello Rave Developers,
> 
> Currently we have lots of duplicated JavaScript import statements <script src=""> across our JSP pages which is not ideal from a maintenance or extension perspective.  I'd like to propose (and plan to implement) the following changes to improve the code base:
> 
> (1) Move all <script src=""> into one central tag file for easier maintenance and overlaying, and import this tag on all JSP pages.  Organize Rave vs external third-party files as appropriate (same file or perhaps separate tags)
> 
> (2) As part of the build, concatenate all of the Rave javascript files into one file for improved performance and bundle it in the WAR
> 
> (3) As part of the build, also minify the concatenated file for even more improved performance and bundle it in the WAR
> 
> (4) Add a new Administrative Preference to choose which file to serve out: the non-minified file (by default for debugging), or the minified file (for performance)
> 
> Thoughts or concerns?  We've performed this design model on other applications internally to great success.  There should be minimal performance impact for serving the entire single Rave JavaScript file on all pages, especially in the best-case scenario when it is minified AND cached appropriately in the browser.
> 
> Thanks, Tony
>