Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(547)

Delta Between Two Patch Sets: bin/merge-files

Issue 6905059: Exclude config.js from minification
Left Patch Set: Created 12 years, 4 months ago
Right Patch Set: Exclude config.js from minification Created 12 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « [revision details] ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/usr/bin/env node 1 #!/usr/bin/env node
2 2
3 /* 3 /*
4 * We aggregate and minimize the JavaScript sources in order to improve the 4 * We aggregate and minimize the JavaScript sources in order to improve the
5 * load speed of the application. 5 * load speed of the application.
6 * 6 *
7 * We don't want to use the YUI combo loader feature because we want to be able 7 * We don't want to use the YUI combo loader feature because we want to be able
8 * to run from only static files and we want to be able to run behind a 8 * to run from only static files and we want to be able to run behind a
9 * firewall without access to the internet. 9 * firewall without access to the internet.
10 * 10 *
(...skipping 18 matching lines...) Expand all
29 29
30 require('yui').YUI().use(['yui'], function(Y) { 30 require('yui').YUI().use(['yui'], function(Y) {
31 var merge = require('../lib/merge-files.js'); 31 var merge = require('../lib/merge-files.js');
32 var syspath = require('path'); 32 var syspath = require('path');
33 33
34 // First we find all of the paths to our custom Javascript in the app 34 // First we find all of the paths to our custom Javascript in the app
35 // directory. We need to tell the function to ignore the "assets" directory 35 // directory. We need to tell the function to ignore the "assets" directory
36 // and the debug version of the modules file. I need to use 36 // and the debug version of the modules file. I need to use
37 // "syspath.join(process.cwd(), ...)" or else I have... "Error: Cannot find 37 // "syspath.join(process.cwd(), ...)" or else I have... "Error: Cannot find
38 // module 'app/config.js'" from node's internal module.js file. 38 // module 'app/config.js'" from node's internal module.js file.
39 // config(-debug).js should also be passed in the ignore list: these files
40 // are included in index.html separately as part of charm configuration,
41 // and should not also be included in the minification.
39 var paths = merge.readdir(syspath.join(process.cwd(), 'app'), 42 var paths = merge.readdir(syspath.join(process.cwd(), 'app'),
40 [syspath.join(process.cwd(), 'app/assets'), 43 [syspath.join(process.cwd(), 'app/assets'),
41 syspath.join(process.cwd(), 'app/modules-debug.js'), 44 syspath.join(process.cwd(), 'app/modules-debug.js'),
42 syspath.join(process.cwd(), 'app/config.js'), 45 syspath.join(process.cwd(), 'app/config.js'),
43 syspath.join(process.cwd(), 'app/config-debug.js')]); 46 syspath.join(process.cwd(), 'app/config-debug.js')]);
gary.poster 2012/12/10 17:18:20 Please add a comment explaining why this is import
44 47
45 // templates.js is a generated file. It is not part of the app directory. 48 // templates.js is a generated file. It is not part of the app directory.
46 paths.push(syspath.join(process.cwd(), 'build/juju-ui/templates.js')); 49 paths.push(syspath.join(process.cwd(), 'build/juju-ui/templates.js'));
47 50
48 merge.combineJs(paths, 'build/juju-ui/assets/app.js'); 51 merge.combineJs(paths, 'build/juju-ui/assets/app.js');
49 52
50 // Get the paths to the YUI modules that we use. 53 // Get the paths to the YUI modules that we use.
51 var reqs = merge.loadRequires(paths); 54 var reqs = merge.loadRequires(paths);
52 55
53 // For some reason the loader does not get these requirements. 56 // For some reason the loader does not get these requirements.
(...skipping 16 matching lines...) Expand all
70 'app/assets/javascripts/svg-layouts.js']); 73 'app/assets/javascripts/svg-layouts.js']);
71 74
72 merge.combineJs(filesToLoad.js, 'build/juju-ui/assets/all-yui.js'); 75 merge.combineJs(filesToLoad.js, 'build/juju-ui/assets/all-yui.js');
73 76
74 var cssFiles = filesToLoad.css; 77 var cssFiles = filesToLoad.css;
75 cssFiles.push('app/assets/stylesheets/bootstrap-2.0.4.css'); 78 cssFiles.push('app/assets/stylesheets/bootstrap-2.0.4.css');
76 cssFiles.push('app/assets/stylesheets/bootstrap-responsive-2.0.4.css'); 79 cssFiles.push('app/assets/stylesheets/bootstrap-responsive-2.0.4.css');
77 merge.combineCSS(cssFiles, 80 merge.combineCSS(cssFiles,
78 'build/juju-ui/assets/combined-css/all-static.css'); 81 'build/juju-ui/assets/combined-css/all-static.css');
79 }); 82 });
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b