← Back to team overview

yellow team mailing list archive

[Merge] lp:~tveronezi/juju-gui/minimized-third-party-js into lp:juju-gui

 

Thiago Veronezi has proposed merging lp:~tveronezi/juju-gui/minimized-third-party-js into lp:juju-gui.

Requested reviews:
  Juju GUI Hackers (juju-gui)

For more details, see:
https://code.launchpad.net/~tveronezi/juju-gui/minimized-third-party-js/+merge/134304

debug should not minimize third party js

If we are debugging third party javascript (app/assets/javscripts/...) and the file is not already minimized, make debug should not serve a minimized version.
-- 
https://code.launchpad.net/~tveronezi/juju-gui/minimized-third-party-js/+merge/134304
Your team Juju GUI Hackers is requested to review the proposed merge of lp:~tveronezi/juju-gui/minimized-third-party-js into lp:juju-gui.
=== modified file 'app/modules.js'
--- app/modules.js	2012-11-13 13:55:16 +0000
+++ app/modules.js	2012-11-14 14:44:22 +0000
@@ -3,17 +3,9 @@
   // YUI will not download the modules. They are supposed to be already loaded.
   ignoreRegistered: true,
 
+  // Please use this object only for defining new aliases.
+  // You can add the fullpath to the libraries in "modules-debug.js".
   groups: {
-    d3: {
-      modules: {
-        'd3': {
-          'fullpath': '/juju-ui/assets/javascripts/d3.v2.min.js'
-        },
-        'd3-components': {
-          fullpath: '/juju-ui/assets/javascripts/d3-components.js'
-        }
-      }
-    },
     juju: {
       modules: {
         'juju-views': {

=== modified file 'bin/merge-files'
--- bin/merge-files	2012-11-13 13:55:16 +0000
+++ bin/merge-files	2012-11-14 14:44:22 +0000
@@ -56,9 +56,14 @@
 
   // Combine third party js libraries
   merge.combine([ './app/assets/javascripts/d3.v2.min.js',
+      './app/assets/javascripts/d3-components.js',
       './app/assets/javascripts/reconnecting-websocket.js',
-      './app/assets/javascripts/svg-layouts.js'],
-      './app/assets/javascripts/generated/all-third.js', true);
+      './app/assets/javascripts/svg-layouts.js' ],
+      './app/assets/javascripts/generated/all-third-min.js', true);
+
+  // It has only one file but eventually it will have more.
+  merge.combine([ './app/assets/javascripts/d3.v2.js' ],
+      './app/assets/javascripts/generated/all-third.js', false);
 
   // Now we only need to generate the file that is used to tell YUI where all
   // the dependencies are.  We either use a debug version or the production

=== modified file 'lib/server.js'
--- lib/server.js	2012-11-09 15:37:08 +0000
+++ lib/server.js	2012-11-14 14:44:22 +0000
@@ -48,7 +48,11 @@
 });
 
 server.get('/assets/all-third.js', function(req, res) {
-  res.sendfile('app/assets/javascripts/generated/all-third.js');
+  if (debugMode) {
+    res.sendfile('app/assets/javascripts/generated/all-third.js');
+  } else {
+    res.sendfile('app/assets/javascripts/generated/all-third-min.js');
+  }
 });
 
 server.get('/assets/modules.js', function(req, res) {


Follow ups