← Back to team overview

yellow team mailing list archive

debug should not minimize third party js (issue 6850049)

 

Reviewers: mp+134304_code.launchpad.net,

Message:
Please take a look.

Description:
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

(do not edit description out of merge proposal)


Please review this at https://codereview.appspot.com/6850049/

Affected files:
   A [revision details]
   M app/modules.js
   M bin/merge-files
   M lib/server.js


Index: [revision details]
=== added file '[revision details]'
--- [revision details]	2012-01-01 00:00:00 +0000
+++ [revision details]	2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: matthew.scott@xxxxxxxxxxxxx-20121113215702-up4sva0th73rnwzb
+New revision: thiago.veronezi@xxxxxxxxxxxxx-20121114144154-bby6dwe4ohuec3vw

Index: app/modules.js
=== modified file 'app/modules.js'
--- app/modules.js	2012-11-13 13:55:16 +0000
+++ app/modules.js	2012-11-14 14:41:54 +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': {


Index: bin/merge-files
=== modified file 'bin/merge-files'
--- bin/merge-files	2012-11-13 13:55:16 +0000
+++ bin/merge-files	2012-11-14 14:41:54 +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


Index: lib/server.js
=== modified file 'lib/server.js'
--- lib/server.js	2012-11-09 15:37:08 +0000
+++ lib/server.js	2012-11-14 14:04:31 +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) {





-- 
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.


References