Webstaff improve JS files minification and concatenation

Bug #1692097 reported by Bill Erickson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
New
Undecided
Unassigned

Bug Description

Evergreen circ 2.12

The Grunt-driven minification and concatenation configuration is missing some parts and not doing all that it could to make JS file downloads more efficient.

I have put together a patch to do the following:

* Support minifying the core Evergreen services files (i.e. service/*.js). Previously, they were only concatenated.

* Create one concatenated file for external dependencies (jquery, angular, etc.) and a separate concatenated file for Evergreen core service files.

Included in this is replacing the template variable EXPAND_WEB_IMPORTS with EXPAND_WEB_DEP_IMPORTS and EXPAND_WEB_CORE_IMPORTS.

The thinking here is that concatenating 3rd party files (which are already minified) is an easy win and should not complicate debugging, whereas minifying and concatenating EG service files will require more testing. It's also nice that you can expand one or the other as needed for debugging.

The build creates evergreen-staff-client.0.0.1.deps.min.js and evergreen-staff-client.0.0.1.core.min.js

* Various fixes to the Gruntfile, including missing dependency references and fixing some faulty assumptions from early iterations of the file.

* Remove OpenSRF JS from the minify/concat processes. Otherwise, we have to add some variable replacements in Gruntfile to avoid hard-coding the path to the OpenSRF js files. Not sure it's worth it for 3 small-ish files.

Revision history for this message
Bill Erickson (berick) wrote :

Patch pushed:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1692097-webstaff-js-minify-repairs

In addition to the above, this patch adds minification support for angular-tree-control.js, ng-order-object-by.js, and ui-bootstrap-tpls.js.

In an attempt to make a move to using all this new stuff, I also set EXPAND_WEB_DEP_IMPORTS=0 by default in the config.tt2 file. This will lump all of the external dependencies into a single JS import.

To test, run 'grunt all', make sure tests pass, install web files, open the browser client, then view source. Instead of imports for 'jquery', 'angular', etc. you should see a single import for:

<script src="/js/ui/default/staff/build/js/evergreen-staff-client.0.0.1.deps.min.js"></script>

Bonus points for testing EXPAND_WEB_CORE_IMPORTS=0. Surprisingly, I had no problems with this, but we probably don't want that to turn that on just yet / in master.

tags: added: pullrequest
Changed in evergreen:
milestone: none → 3.0-alpha
assignee: Bill Erickson (berick) → nobody
Revision history for this message
Bill Erickson (berick) wrote :

Removing pullrequest for now. This will need dusting off and rebasing after the 3.0 code rush.

tags: removed: pullrequest
Revision history for this message
Bill Erickson (berick) wrote :

See also bug #1680140 -- consider merging.

Bill Erickson (berick)
Changed in evergreen:
milestone: 3.0-alpha → none
Revision history for this message
Bill Erickson (berick) wrote :

Will likely be superseded by bug #1739803

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.