LEFT | RIGHT |
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 Loading... |
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')]); |
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 Loading... |
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 }); |
LEFT | RIGHT |