Merge lp:~tveronezi/juju-gui/uglify into lp:juju-gui/experimental

Proposed by Thiago Veronezi
Status: Merged
Merged at revision: 235
Proposed branch: lp:~tveronezi/juju-gui/uglify
Merge into: lp:juju-gui/experimental
Diff against target: 664 lines (+398/-115)
11 files modified
.bzrignore (+1/-0)
Makefile (+21/-3)
app/index.html (+3/-3)
app/modules-debug.js (+131/-0)
app/modules.js (+7/-104)
bin/merge-files (+75/-0)
grunt.js (+1/-1)
lib/merge-files.js (+137/-0)
lib/server.js (+19/-2)
package.json (+2/-1)
test/index.html (+1/-1)
To merge this branch: bzr merge lp:~tveronezi/juju-gui/uglify
Reviewer Review Type Date Requested Status
Benji York (community) code Approve
Review via email: mp+133116@code.launchpad.net

Description of the change

Resource minification/aggregation js

* We should aggregate and minimize the js sources in order to improve the load speed of the application;
* We dont want to use the yui combo loader feature;
* The final product will provide three js files: one for the YUI dependencies, one for our custom js code and one for third part js like d3.

https://codereview.appspot.com/6821090/

To post a comment you must log in.
Revision history for this message
Thiago Veronezi (tveronezi) wrote :

Reviewers: mp+133116_code.launchpad.net,

Message:
Please take a look.

Description:
Resource minification/aggregation js

* We should aggregate and minimize the js sources in order to improve
the load speed of the application;
* We dont want to use the yui combo loader feature;
* The final product will provide three js files: one for the YUI
dependencies, one for our custom js code and one for third part js like
d3.

https://code.launchpad.net/~tveronezi/juju-gui/uglify/+merge/133116

(do not edit description out of merge proposal)

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

Affected files:
   M .bzrignore
   M Makefile
   A [revision details]
   M app/index.html
   A app/modules-debug.js
   M app/modules.js
   M grunt.js
   M lib/server.js
   A merge-files.js
   M package.json
   A properties-dev.js
   A properties-prod.js
   M test/index.html

lp:~tveronezi/juju-gui/uglify updated
233. By Thiago Veronezi

using yui loop functions

Revision history for this message
Thiago Veronezi (tveronezi) wrote :

https://codereview.appspot.com/6821090/diff/1/merge-files.js
File merge-files.js (right):

https://codereview.appspot.com/6821090/diff/1/merge-files.js#newcode25
merge-files.js:25: function loop(arr, callback) {
Please ignore this method. I am using the Y.each version of it.

https://codereview.appspot.com/6821090/

Revision history for this message
Thiago Veronezi (tveronezi) wrote :
lp:~tveronezi/juju-gui/uglify updated
234. By Thiago Veronezi

generated combined files should go under /app/Error: listen EADDRINUSE

Revision history for this message
Thiago Veronezi (tveronezi) wrote :
lp:~tveronezi/juju-gui/uglify updated
235. By Thiago Veronezi

the combine code should go under the combine directory

236. By Thiago Veronezi

the combine code should go under the combine directory

Revision history for this message
Thiago Veronezi (tveronezi) wrote :
Revision history for this message
Thiago Veronezi (tveronezi) wrote :

Thanks, Benji!

https://codereview.appspot.com/6821090/diff/7001/Makefile
File Makefile (right):

https://codereview.appspot.com/6821090/diff/7001/Makefile#newcode12
Makefile:12: node_modules/grunt node_modules/node-spritesheet
node_modules/node-minify
This line does not have more than 80 chars, but I changed it anyway.

On 2012/11/07 17:05:18, benji wrote:
> This line is too long.

https://codereview.appspot.com/6821090/diff/7001/Makefile#newcode75
Makefile:75: @cp app/assets/combine/properties-dev.js
app/assets/javascripts/generated/properties.js
On 2012/11/07 17:05:18, benji wrote:
> This line is too long.

Done.

https://codereview.appspot.com/6821090/diff/7001/Makefile#newcode80
Makefile:80: @cp app/assets/combine/properties-prod.js
app/assets/javascripts/generated/properties.js
On 2012/11/07 17:05:18, benji wrote:
> This line is too long.

Done.

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js
File app/assets/combine/merge-files.js (right):

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode1
app/assets/combine/merge-files.js:1: 'use strict';
This is entirely ours.

On 2012/11/07 17:05:18, benji wrote:
> Is this code we wrote or was it imported from somewhere? If it was
written
> elsewhere, we need to specify its license and it would be nice to know
where it
> came from.

> I will forgo reviewing the code until I know the answers to the above.

https://codereview.appspot.com/6821090/diff/7001/app/index.html
File app/index.html (right):

https://codereview.appspot.com/6821090/diff/7001/app/index.html#newcode72
app/index.html:72: <script src="/source/yui.js"></script>
What about '/assets/yui.js'? Id this ok?

On 2012/11/07 17:05:18, benji wrote:
> We have been calling these things "assets". If the change to "source"
was a
> considered one, then I am fine with it. If not, we should continue to
use the
> same terminology that we have been using.

https://codereview.appspot.com/6821090/diff/7001/lib/server.js
File lib/server.js (right):

https://codereview.appspot.com/6821090/diff/7001/lib/server.js#newcode50
lib/server.js:50: server.get('/source/all-third.js', function(req, res)
{
I want to hide the real path.
I can change it to '/assets/all-third.js', would it be ok?

On 2012/11/07 17:05:18, benji wrote:
> Why should the path exposed via HTTP ("source") be different than the
path on
> disk ("assets")?

https://codereview.appspot.com/6821090/

lp:~tveronezi/juju-gui/uglify updated
237. By Thiago Veronezi

code review

Revision history for this message
Gary Poster (gary) wrote :
Download full text (6.1 KiB)

Hi Thiago. Thank you for this nice step forward: it will be great when
we have this functionality, and the debug/developer story you've
arranged is nicer than I expected.

This is a preliminary review. As I mention, I want to review
merge-files.js more later, but I'm going to let Benji take a first pass
and send my notes so far to you sooner.

Gary

https://codereview.appspot.com/6821090/diff/7001/Makefile
File Makefile (right):

https://codereview.appspot.com/6821090/diff/7001/Makefile#newcode64
Makefile:64: combinejs: $(NODE_TARGETS)
As I mentioned on IRC, this has the same problem we talked about with
sprite generation: every time you run the target it will try to compress
the files. Since install depends on this, and just about everything
depends on install, this can affect most make targets and be pretty
annoying.

One approach to solving this is http://pastebin.ubuntu.com/1340722/

https://codereview.appspot.com/6821090/diff/7001/Makefile#newcode89
Makefile:89: @rm -Rf app/assets/javascripts/generated/
Good.

https://codereview.appspot.com/6821090/diff/7001/Makefile#newcode107
Makefile:107: combinejs
Good.

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js
File app/assets/combine/merge-files.js (right):

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode1
app/assets/combine/merge-files.js:1: 'use strict';
I don't think this file belongs in app/assets. This is a build
component, and we never want to serve it as part of the application. I
suggest that we put it in the top directory, or in bin. I lean towards
bin.

This is as good a time as any to mention that I think this branch is a
great example of something that could have probably benefitted from a
pre-implementation call (and maybe a prototyping).

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode3
app/assets/combine/merge-files.js:3: //
http://stackoverflow.com/questions/5348685/node-js-require-inheritance
Nice that you gave attribution. I personally don't think it is
necessary in this case. It was good to see as a reviewer, but it would
have been even better as part of your "cover letter" introduction to
your branch.

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode6
app/assets/combine/merge-files.js:6: var Y = YUI(),
Why did you choose to do this rather than "YUI().use(..., function(Y)
{...});"?

You could even remove line 4. One approach:

require('yui').YUI().use(...);

another approach:

var Y = require('yui').YUI(),

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode27
app/assets/combine/merge-files.js:27: (function() {
I have a number of comments I already suspect I want to make about this
file--here, for instance, I think I will request that you add a lot more
comments, and possibly refactor, and possibly reconsider your approach
to compartmentalizing the various parts of the file. However, I
conferred with Benji, and I am going to be lazy and see what he has to
say first, and then follow along afterwards. That way I can get my
other comments to you faster.

https://code...

Read more...

Revision history for this message
Thiago Veronezi (tveronezi) wrote :
Download full text (7.3 KiB)

Thanks Gary.

https://codereview.appspot.com/6821090/diff/7001/Makefile
File Makefile (right):

https://codereview.appspot.com/6821090/diff/7001/Makefile#newcode64
Makefile:64: combinejs: $(NODE_TARGETS)
On 2012/11/07 20:49:31, gary.poster wrote:
> As I mentioned on IRC, this has the same problem we talked about with
sprite
> generation: every time you run the target it will try to compress the
files.
> Since install depends on this, and just about everything depends on
install,
> this can affect most make targets and be pretty annoying.

> One approach to solving this is http://pastebin.ubuntu.com/1340722/

Done.

https://codereview.appspot.com/6821090/diff/7001/Makefile#newcode75
Makefile:75: @cp app/assets/combine/properties-dev.js
app/assets/javascripts/generated/properties.js
On 2012/11/07 17:05:18, benji wrote:
> This line is too long.

Done.

https://codereview.appspot.com/6821090/diff/7001/Makefile#newcode89
Makefile:89: @rm -Rf app/assets/javascripts/generated/
On 2012/11/07 20:49:31, gary.poster wrote:
> Good.

Done.

https://codereview.appspot.com/6821090/diff/7001/Makefile#newcode107
Makefile:107: combinejs
On 2012/11/07 20:49:31, gary.poster wrote:
> Good.

Done.

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js
File app/assets/combine/merge-files.js (right):

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode1
app/assets/combine/merge-files.js:1: 'use strict';
On 2012/11/07 20:49:31, gary.poster wrote:
> I don't think this file belongs in app/assets. This is a build
component, and
> we never want to serve it as part of the application. I suggest that
we put it
> in the top directory, or in bin. I lean towards bin.

> This is as good a time as any to mention that I think this branch is a
great
> example of something that could have probably benefitted from a
> pre-implementation call (and maybe a prototyping).

This branch had a pre-implementation call. I moved this file here
because Ben asked me to do it.

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode3
app/assets/combine/merge-files.js:3: //
http://stackoverflow.com/questions/5348685/node-js-require-inheritance
On 2012/11/07 20:49:31, gary.poster wrote:
> Nice that you gave attribution. I personally don't think it is
necessary in
> this case. It was good to see as a reviewer, but it would have been
even better
> as part of your "cover letter" introduction to your branch.

This is not part of the global solution. This is here just to explain
why I use the "global" object.

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode6
app/assets/combine/merge-files.js:6: var Y = YUI(),
On 2012/11/07 20:49:31, gary.poster wrote:
> Why did you choose to do this rather than "YUI().use(..., function(Y)
{...});"?

> You could even remove line 4. One approach:

> require('yui').YUI().use(...);

> another approach:

> var Y = require('yui').YUI(),

I did it because I dont require any internal yui code. I use it to get
the Y.Object, Y.Array and Y.Loader objects.

I cannot remove the line 4. It is used by the line 82. When node
executes...

Read more...

lp:~tveronezi/juju-gui/uglify updated
238. By Thiago Veronezi

code review

239. By Thiago Veronezi

trunk merge

240. By Thiago Veronezi

code review

241. By Thiago Veronezi

code review

Revision history for this message
Thiago Veronezi (tveronezi) wrote :
Download full text (5.1 KiB)

Tkx Benji.

https://codereview.appspot.com/6821090/diff/7001/Makefile
File Makefile (right):

https://codereview.appspot.com/6821090/diff/7001/Makefile#newcode12
Makefile:12: node_modules/grunt node_modules/node-spritesheet
node_modules/node-minify
On 2012/11/07 22:00:47, benji wrote:
> On 2012/11/07 18:59:19, thiago wrote:
> > This line does not have more than 80 chars, but I changed it anyway.

> Correct, it has fewer than 80 characters but one of those characters
is a tab,
> which in most editors displays as 8 spaces, pushing the line over 80
displayed
> characters.

Ok

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js
File app/assets/combine/merge-files.js (right):

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode1
app/assets/combine/merge-files.js:1: 'use strict';
On 2012/11/07 22:00:47, benji wrote:
> On 2012/11/07 18:59:19, thiago wrote:
> > This is entirely ours.

> Top-posting makes replying to comments difficult. Please reply below
the
> previous comment.

Ok

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode3
app/assets/combine/merge-files.js:3: //
http://stackoverflow.com/questions/5348685/node-js-require-inheritance
On 2012/11/07 22:00:47, benji wrote:
> Even after reading the page at the other end of this link I don't know
what it
> has to do with the code here. Additional comments would help.

Done.

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode5
app/assets/combine/merge-files.js:5:
On 2012/11/07 22:00:47, benji wrote:
> I am surprised that we had to write this script. I would have
expected someone,
> somewhere to have already done this for us.

Not really. People usually use the comboloader for yui applications. I
had a lot of fun writing it though.

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode14
app/assets/combine/merge-files.js:14: var execution = new
compressor.minify({
On 2012/11/07 22:00:47, benji wrote:
> object literal style

How should it be?

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode88
app/assets/combine/merge-files.js:88: var reqs = (function() {
On 2012/11/07 22:00:47, benji wrote:
> This function would benefit from a name.

This is not a function. This is an object: a list of all the yui
requirements we need to load.

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode105
app/assets/combine/merge-files.js:105: // Using the example
http://yuilibrary.com/yui/docs/yui/loader-resolve.html
On 2012/11/07 22:00:47, benji wrote:
> I am not sure what this comment is trying to communicate. Is it that
I can find
> an explanation of the YUI loader mechanism at the given URL?

Nop. It uses the reqs object that we created in the previous block and
figures out the js files that contain it.

I will add it as comment here.

https://codereview.appspot.com/6821090/diff/7001/app/assets/combine/merge-files.js#newcode111
app/assets/combine/merge-files.js:111: loader = new Y.Loader({
On 2012/11/07 22:00:47, benji wrote:
> object literal sty...

Read more...

lp:~tveronezi/juju-gui/uglify updated
242. By Thiago Veronezi

making lint happy

Revision history for this message
Thiago Veronezi (tveronezi) wrote :
lp:~tveronezi/juju-gui/uglify updated
243. By Thiago Veronezi

missing commit

Revision history for this message
Thiago Veronezi (tveronezi) wrote :

https://codereview.appspot.com/6821090/diff/3002/Makefile
File Makefile (right):

https://codereview.appspot.com/6821090/diff/3002/Makefile#newcode12
Makefile:12: node_modules/grunt node_modules/node-spritesheet
node_modules/node-minify
Missing commit. You should see this line break in the next commit.

https://codereview.appspot.com/6821090/

lp:~tveronezi/juju-gui/uglify updated
244. By Thiago Veronezi

code review

245. By Thiago Veronezi

code review

246. By Thiago Veronezi

moving the functions to the lib directory

Revision history for this message
Thiago Veronezi (tveronezi) wrote :
Revision history for this message
Thiago Veronezi (tveronezi) wrote :

https://codereview.appspot.com/6821090/diff/15005/bin/merge-files
File bin/merge-files (right):

https://codereview.appspot.com/6821090/diff/15005/bin/merge-files#newcode20
bin/merge-files:20: global.YUI = require('yui').YUI;
Please ignore this entry. I moved it to the lib/merge-files.js file.

=== modified file 'bin/merge-files'
--- bin/merge-files 2012-11-09 12:54:56 +0000
+++ bin/merge-files 2012-11-09 13:00:19 +0000
@@ -14,12 +14,7 @@

  'use strict';

-// We need the yui name to be available in all modules (as a global
variable).
-// This only happens if we remove the 'var' keyword or add it to the
"global"
-// variable.
-global.YUI = require('yui').YUI;
-
-YUI().use(['yui'], function(Y) {
+require('yui').YUI().use(['yui'], function(Y) {
    var merge = require('../lib/merge-files.js'),
        syspath = require('path'),
        paths,

https://codereview.appspot.com/6821090/

lp:~tveronezi/juju-gui/uglify updated
247. By Thiago Veronezi

code review

Revision history for this message
Gary Poster (gary) wrote :
Download full text (4.2 KiB)

This is looking good, Thiago. Thank you!

As we discussed, I'm OK with holding off on tests. The last non-trivial
thing I'd like to see is removing the code that writes properties. I
give two possible approaches below.

I'm happy to have a call if it helps, or leave it to you, as you prefer.

Thanks!

Gary

https://codereview.appspot.com/6821090/diff/15005/Makefile
File Makefile (right):

https://codereview.appspot.com/6821090/diff/15005/Makefile#newcode82
Makefile:82: @./bin/write-properties true
I really would like to see this (and the corresponding line in 87 and
the corresponding "write-properties" script) go.

My preferred approach, which we talked about yesterday, would be to make
the server always have both the debug version (debug.html?) and the
production version (index.html) available, by having the server
dynamically change the js files that index.html points to.

Alternatively, server.js would accept an argument to turn on debug mode.
  By default, it would run in prodcution mode.

https://codereview.appspot.com/6821090/diff/15005/app/modules-debug.js
File app/modules-debug.js (right):

https://codereview.appspot.com/6821090/diff/15005/app/modules-debug.js#newcode1
app/modules-debug.js:1: GlobalConfig = {
An idea (as in, do this if you agree): it would be nice to have a
comment at the top of this file saying that it is only used for the
debug (developer) views of the application, and pointing to the
mechanism that is used (e.g., in server.js) to serve this file rather
than the other one.

Maybe it's overkill. I'd do it, but I'd be fine with accepting
disagreement.

https://codereview.appspot.com/6821090/diff/15005/app/modules.js
File app/modules.js (right):

https://codereview.appspot.com/6821090/diff/15005/app/modules.js#newcode4
app/modules.js:4: ignoreRegistered: true,
Is there a setting we can use to say "never download anything from the
internet, ever"? If so, I suggest we use that both for this and the
debug modules file.

Is it bootstrap: false? Or is this already handled somehow?

https://codereview.appspot.com/6821090/diff/15005/bin/merge-files
File bin/merge-files (right):

https://codereview.appspot.com/6821090/diff/15005/bin/merge-files#newcode1
bin/merge-files:1: #!/usr/bin/env node
These changes look great to me. Thanks.

https://codereview.appspot.com/6821090/diff/15005/bin/merge-files#newcode4
bin/merge-files:4: * We should aggregate and minimize the js sources in
order to improve the load
suggestion: delete "should". (We are doing it. :-) )

https://codereview.appspot.com/6821090/diff/15005/bin/merge-files#newcode8
bin/merge-files:8: * to run from only static files and we want to be
able to run behaind a
"behind" (I realize these are probably my fault. sorry :-) )

https://codereview.appspot.com/6821090/diff/15005/bin/write-properties
File bin/write-properties (right):

https://codereview.appspot.com/6821090/diff/15005/bin/write-properties#newcode1
bin/write-properties:1: #!/usr/bin/env node
As I said, I'd like to delete.

https://codereview.appspot.com/6821090/diff/15005/lib/merge-files.js
File lib/merge-files.js (right):

https://codereview.appspot.com/6821090/diff/15005/lib/merge-files.js#newcode14
lib...

Read more...

Revision history for this message
Thiago Veronezi (tveronezi) wrote :
Download full text (4.2 KiB)

https://codereview.appspot.com/6821090/diff/15005/Makefile
File Makefile (right):

https://codereview.appspot.com/6821090/diff/15005/Makefile#newcode82
Makefile:82: @./bin/write-properties true
On 2012/11/09 13:57:38, gary.poster wrote:
> I really would like to see this (and the corresponding line in 87 and
the
> corresponding "write-properties" script) go.

> My preferred approach, which we talked about yesterday, would be to
make the
> server always have both the debug version (debug.html?) and the
production
> version (index.html) available, by having the server dynamically
change the js
> files that index.html points to.

> Alternatively, server.js would accept an argument to turn on debug
mode. By
> default, it would run in prodcution mode.

Using the server approach for now.
Thanks for this idea. Really good.

https://codereview.appspot.com/6821090/diff/15005/app/modules-debug.js
File app/modules-debug.js (right):

https://codereview.appspot.com/6821090/diff/15005/app/modules-debug.js#newcode1
app/modules-debug.js:1: GlobalConfig = {
On 2012/11/09 13:57:38, gary.poster wrote:
> An idea (as in, do this if you agree): it would be nice to have a
comment at the
> top of this file saying that it is only used for the debug (developer)
views of
> the application, and pointing to the mechanism that is used (e.g., in
server.js)
> to serve this file rather than the other one.

> Maybe it's overkill. I'd do it, but I'd be fine with accepting
disagreement.

Done.

https://codereview.appspot.com/6821090/diff/15005/bin/merge-files
File bin/merge-files (right):

https://codereview.appspot.com/6821090/diff/15005/bin/merge-files#newcode1
bin/merge-files:1: #!/usr/bin/env node
On 2012/11/09 13:57:38, gary.poster wrote:
> These changes look great to me. Thanks.

Done.

https://codereview.appspot.com/6821090/diff/15005/bin/merge-files#newcode4
bin/merge-files:4: * We should aggregate and minimize the js sources in
order to improve the load
On 2012/11/09 13:57:38, gary.poster wrote:
> suggestion: delete "should". (We are doing it. :-) )

Done.

https://codereview.appspot.com/6821090/diff/15005/bin/merge-files#newcode8
bin/merge-files:8: * to run from only static files and we want to be
able to run behaind a
On 2012/11/09 13:57:38, gary.poster wrote:
> "behind" (I realize these are probably my fault. sorry :-) )

Done.

https://codereview.appspot.com/6821090/diff/15005/bin/write-properties
File bin/write-properties (right):

https://codereview.appspot.com/6821090/diff/15005/bin/write-properties#newcode1
bin/write-properties:1: #!/usr/bin/env node
On 2012/11/09 13:57:38, gary.poster wrote:
> As I said, I'd like to delete.

Done.

https://codereview.appspot.com/6821090/diff/15005/lib/merge-files.js
File lib/merge-files.js (right):

https://codereview.appspot.com/6821090/diff/15005/lib/merge-files.js#newcode14
lib/merge-files.js:14: // end.
On 2012/11/09 13:57:38, gary.poster wrote:
> Another option (up to you): remove this comment, and do the export of
each
> function as you define it ("expose.minify = function(file) {...}" for
instance)
> or immediately after you define it.

Done.

https://codereview.appspot.com/6821090/diff/15005/lib/merge-files.js#newc...

Read more...

lp:~tveronezi/juju-gui/uglify updated
248. By Thiago Veronezi

code review

249. By Thiago Veronezi

add comments about 'bootstrap=false'

Revision history for this message
Thiago Veronezi (tveronezi) wrote :

https://codereview.appspot.com/6821090/diff/15005/app/modules.js
File app/modules.js (right):

https://codereview.appspot.com/6821090/diff/15005/app/modules.js#newcode4
app/modules.js:4: ignoreRegistered: true,
On 2012/11/09 13:57:38, gary.poster wrote:
> Is there a setting we can use to say "never download anything from the
internet,
> ever"? If so, I suggest we use that both for this and the debug
modules file.

> Is it bootstrap: false? Or is this already handled somehow?

We agreed that it wont be possible to use it. I've added comments about
this know issue in the "merge-files" file.

https://codereview.appspot.com/6821090/

lp:~tveronezi/juju-gui/uglify updated
250. By Thiago Veronezi

add comments about 'bootstrap=false'

Revision history for this message
Thiago Veronezi (tveronezi) wrote :
Revision history for this message
Gary Poster (gary) wrote :

Hi Thiago. This looks good to me.

Per our discussions:

- We are foregoing tests on the lib functions. You can see now how you
would do them. You might do a follow-up branch with tests or might not.
  I would be happy to see that change. However, I won't stop you from
landing this without them.

- We are foregoing the "bootstrap=false" change that forces us to keep
from downloading files. It would be a nice seatbelt but it had problems
that you documented.

Thank you!

Gary

https://codereview.appspot.com/6821090/diff/2005/Makefile
File Makefile (right):

https://codereview.appspot.com/6821090/diff/2005/Makefile#newcode83
Makefile:83: @node server.js debug
yay, much nicer, thanks

https://codereview.appspot.com/6821090/diff/2005/app/modules-debug.js
File app/modules-debug.js (right):

https://codereview.appspot.com/6821090/diff/2005/app/modules-debug.js#newcode3
app/modules-debug.js:3: // "lib/server.js".
Great.

https://codereview.appspot.com/6821090/

Revision history for this message
Benji York (benji) :
review: Approve (code)
lp:~tveronezi/juju-gui/uglify updated
251. By Thiago Veronezi

trunk merge

Revision history for this message
Thiago Veronezi (tveronezi) wrote :

*** Submitted:

Resource minification/aggregation js

* We should aggregate and minimize the js sources in order to improve
the load speed of the application;
* We dont want to use the yui combo loader feature;
* The final product will provide three js files: one for the YUI
dependencies, one for our custom js code and one for third part js like
d3.

R=benji, gary.poster
CC=
https://codereview.appspot.com/6821090

https://codereview.appspot.com/6821090/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2012-10-31 09:16:13 +0000
+++ .bzrignore 2012-11-09 20:53:21 +0000
@@ -20,3 +20,4 @@
20yuidoc20yuidoc
21app/assets/manifest.appcache21app/assets/manifest.appcache
22app/assets/sprite22app/assets/sprite
23app/assets/javascripts/generated/
2324
=== modified file 'Makefile'
--- Makefile 2012-11-06 13:16:34 +0000
+++ Makefile 2012-11-09 20:53:21 +0000
@@ -9,10 +9,15 @@
9 node_modules/mocha node_modules/d3 node_modules/graceful-fs \9 node_modules/mocha node_modules/d3 node_modules/graceful-fs \
10 node_modules/should node_modules/jshint node_modules/expect.js \10 node_modules/should node_modules/jshint node_modules/expect.js \
11 node_modules/express node_modules/yui node_modules/yuidoc \11 node_modules/express node_modules/yui node_modules/yuidoc \
12 node_modules/grunt node_modules/node-spritesheet12 node_modules/grunt node_modules/node-spritesheet \
13 node_modules/node-minify
13TEMPLATE_TARGETS=$(shell bzr ls -k file app/templates)14TEMPLATE_TARGETS=$(shell bzr ls -k file app/templates)
14SPRITE_SOURCE_FILES=$(shell bzr ls -R -k file app/assets/images)15SPRITE_SOURCE_FILES=$(shell bzr ls -R -k file app/assets/images)
15SPRITE_GENERATED_FILES=app/assets/sprite/sprite.css app/assets/sprite/sprite.png16SPRITE_GENERATED_FILES=app/assets/sprite/sprite.css app/assets/sprite/sprite.png
17COMPRESSED_FILES=app/assets/javascripts/generated/all-app-debug.js \
18 app/assets/javascripts/generated/all-app.js \
19 app/assets/javascripts/generated/all-third.js \
20 app/assets/javascripts/generated/all-yui.js
16DATE=$(shell date -u)21DATE=$(shell date -u)
17APPCACHE=app/assets/manifest.appcache22APPCACHE=app/assets/manifest.appcache
1823
@@ -37,7 +42,7 @@
37 @ln -sf `pwd`/node_modules/yui ./app/assets/javascripts/42 @ln -sf `pwd`/node_modules/yui ./app/assets/javascripts/
38 @ln -sf `pwd`/node_modules/d3/d3.v2* ./app/assets/javascripts/43 @ln -sf `pwd`/node_modules/d3/d3.v2* ./app/assets/javascripts/
3944
40install: appcache $(NODE_TARGETS) app/templates.js yuidoc spritegen45install: appcache $(NODE_TARGETS) app/templates.js yuidoc spritegen combinejs
4146
42gjslint: virtualenv/bin/gjslint47gjslint: virtualenv/bin/gjslint
43 @virtualenv/bin/gjslint --strict --nojsdoc --jslint_error=all \48 @virtualenv/bin/gjslint --strict --nojsdoc --jslint_error=all \
@@ -61,11 +66,22 @@
6166
62spritegen: $(SPRITE_GENERATED_FILES)67spritegen: $(SPRITE_GENERATED_FILES)
6368
69$(COMPRESSED_FILES): node_modules/yui node_modules/d3/d3.v2.min.js $(JSFILES)
70 @rm -Rf app/assets/javascripts/generated/
71 @mkdir app/assets/javascripts/generated/
72 @./bin/merge-files
73
74combinejs: $(COMPRESSED_FILES)
75
64prep: beautify lint76prep: beautify lint
6577
66test: install78test: install
67 @./test-server.sh79 @./test-server.sh
6880
81debug: install
82 @echo "Customize config.js to modify server settings"
83 @node server.js debug
84
69server: install85server: install
70 @echo "Customize config.js to modify server settings"86 @echo "Customize config.js to modify server settings"
71 @node server.js87 @node server.js
@@ -75,6 +91,7 @@
75 @make -C docs clean91 @make -C docs clean
76 @rm -Rf bin/sprite/92 @rm -Rf bin/sprite/
77 @rm -Rf app/assets/sprite/93 @rm -Rf app/assets/sprite/
94 @rm -Rf app/assets/javascripts/generated/
7895
79$(APPCACHE): manifest.appcache.in96$(APPCACHE): manifest.appcache.in
80 @cp manifest.appcache.in $(APPCACHE)97 @cp manifest.appcache.in $(APPCACHE)
@@ -91,4 +108,5 @@
91appcache-force: appcache-touch appcache108appcache-force: appcache-touch appcache
92109
93.PHONY: test lint beautify server install clean prep jshint gjslint \110.PHONY: test lint beautify server install clean prep jshint gjslint \
94 appcache appcache-touch appcache-force yuidoc spritegen yuidoc-lint111 appcache appcache-touch appcache-force yuidoc spritegen yuidoc-lint \
112 combinejs
95113
=== modified file 'app/index.html'
--- app/index.html 2012-11-01 13:21:53 +0000
+++ app/index.html 2012-11-09 20:53:21 +0000
@@ -69,9 +69,9 @@
69 <div id="vp-right-border"></div>69 <div id="vp-right-border"></div>
70 </div>70 </div>
71 <!-- javascript away -->71 <!-- javascript away -->
72 <script src="/juju-ui/assets/javascripts/yui/yui/yui-debug.js"></script>72 <script src="/assets/yui.js"></script>
73 <script src="/juju-ui/modules.js"></script>73 <script src="/assets/all-third.js"></script>
74 <script src="/config.js"></script>74 <script src="/assets/modules.js"></script>
75 <script>75 <script>
76 YUI(GlobalConfig).use(["juju-gui"], function(Y) {76 YUI(GlobalConfig).use(["juju-gui"], function(Y) {
77 app = new Y.juju.App(juju_config);77 app = new Y.juju.App(juju_config);
7878
=== added file 'app/modules-debug.js'
--- app/modules-debug.js 1970-01-01 00:00:00 +0000
+++ app/modules-debug.js 2012-11-09 20:53:21 +0000
@@ -0,0 +1,131 @@
1// This file is used for development only. In order to use it you should call
2// the "make debug" command. This command passes the "debug" argument to the
3// "lib/server.js".
4GlobalConfig = {
5 filter: 'debug',
6 // Set "true" for verbose logging of YUI
7 debug: false,
8
9 // Use Rollups
10 combine: false,
11
12 groups: {
13 d3: {
14 modules: {
15 'd3': {
16 'fullpath': '/juju-ui/assets/javascripts/d3.v2.min.js'
17 }
18 }
19 },
20 juju: {
21 modules: {
22 // Primitives
23
24 'svg-layouts': {
25 fullpath: '/juju-ui/assets/javascripts/svg-layouts.js'
26 },
27
28 'reconnecting-websocket': {
29 fullpath: '/juju-ui/assets/javascripts/reconnecting-websocket.js'
30 },
31
32 // Views
33 'juju-view-utils': {
34 fullpath: '/juju-ui/views/utils.js'
35 },
36
37 'juju-charm-panel': {
38 fullpath: '/juju-ui/views/charm-panel.js'
39 },
40
41 'juju-notifications': {
42 fullpath: '/juju-ui/views/notifications.js'
43 },
44
45 'juju-view-environment': {
46 fullpath: '/juju-ui/views/environment.js'
47 },
48
49 'juju-view-service': {
50 fullpath: '/juju-ui/views/service.js'
51 },
52
53 'juju-view-unit': {
54 fullpath: '/juju-ui/views/unit.js'
55 },
56
57 'juju-view-charm-collection': {
58 fullpath: '/juju-ui/views/charm.js'
59 },
60
61 'juju-view-charm': {
62 fullpath: '/juju-ui/views/charm.js'
63 },
64
65 'juju-templates': {
66 fullpath: '/juju-ui/templates.js'
67 },
68
69 'juju-views': {
70 use: [
71 'juju-templates',
72 'juju-notifications',
73 'juju-view-utils',
74 'juju-view-environment',
75 'juju-view-service',
76 'juju-view-unit',
77 'juju-view-charm',
78 'juju-view-charm-collection'
79 ]
80 },
81
82 // Models
83 'juju-endpoints': {
84 fullpath: '/juju-ui/models/endpoints.js'
85 },
86
87 'juju-charm-models': {
88 requires: ['juju-charm-id'],
89 fullpath: '/juju-ui/models/charm.js'
90 },
91
92 'juju-models': {
93 requires: [
94 'model', 'model-list', 'juju-endpoints', 'juju-charm-models'],
95 fullpath: '/juju-ui/models/models.js'
96 },
97
98 // Connectivity
99 'juju-env': {
100 requires: ['reconnecting-websocket'],
101 fullpath: '/juju-ui/store/env.js'
102 },
103
104 'juju-notification-controller': {
105 fullpath: '/juju-ui/store/notifications.js'
106 },
107
108 'juju-charm-store': {
109 requires: ['juju-charm-id'],
110 fullpath: '/juju-ui/store/charm.js'
111 },
112
113 'juju-controllers': {
114 use: ['juju-env', 'juju-charm-store',
115 'juju-notification-controller']
116 },
117
118 // App
119 'juju-gui': {
120 fullpath: '/juju-ui/app.js',
121 requires: [
122 'juju-controllers',
123 'juju-views',
124 'juju-models',
125 'juju-view-charm-search'
126 ]
127 }
128 }
129 }
130 }
131};
0132
=== modified file 'app/modules.js'
--- app/modules.js 2012-11-01 13:30:58 +0000
+++ app/modules.js 2012-11-09 20:53:21 +0000
@@ -1,69 +1,11 @@
1GlobalConfig = {1GlobalConfig = {
2 // Uncomment for debug versions of YUI.
3 filter: 'debug',
4 // Uncomment for verbose logging of YUI
5 debug: false,2 debug: false,
63 // YUI will not download the modules. They are supposed to be already loaded.
7 // Use Rollups4 ignoreRegistered: true,
8 combine: false,
95
10 groups: {6 groups: {
11 d3: {
12 modules: {
13 'd3': {
14 'fullpath': '/juju-ui/assets/javascripts/d3.v2.min.js'
15 }
16 }
17 },
18 juju: {7 juju: {
19 modules: {8 modules: {
20 // Primitives
21
22 'svg-layouts': {
23 fullpath: '/juju-ui/assets/javascripts/svg-layouts.js'
24 },
25
26 'reconnecting-websocket': {
27 fullpath: '/juju-ui/assets/javascripts/reconnecting-websocket.js'
28 },
29
30 // Views
31 'juju-view-utils': {
32 fullpath: '/juju-ui/views/utils.js'
33 },
34
35 'juju-charm-panel': {
36 fullpath: '/juju-ui/views/charm-panel.js'
37 },
38
39 'juju-notifications': {
40 fullpath: '/juju-ui/views/notifications.js'
41 },
42
43 'juju-view-environment': {
44 fullpath: '/juju-ui/views/environment.js'
45 },
46
47 'juju-view-service': {
48 fullpath: '/juju-ui/views/service.js'
49 },
50
51 'juju-view-unit': {
52 fullpath: '/juju-ui/views/unit.js'
53 },
54
55 'juju-view-charm-collection': {
56 fullpath: '/juju-ui/views/charm.js'
57 },
58
59 'juju-view-charm': {
60 fullpath: '/juju-ui/views/charm.js'
61 },
62
63 'juju-templates': {
64 fullpath: '/juju-ui/templates.js'
65 },
66
67 'juju-views': {9 'juju-views': {
68 use: [10 use: [
69 'juju-templates',11 'juju-templates',
@@ -77,51 +19,12 @@
77 ]19 ]
78 },20 },
7921
80 // Models22 // 'juju-controllers' is just an alias for the modules defined by 'use'
81 'juju-endpoints': {23 // If we use "requires: ['juju-controllers']" that means
82 fullpath: '/juju-ui/models/endpoints.js'24 // "requires: ['juju-env', 'juju-charm-store',
83 },25 // 'juju-notification-controller']"
84
85 'juju-charm-models': {
86 requires: ['juju-charm-id'],
87 fullpath: '/juju-ui/models/charm.js'
88 },
89
90 'juju-models': {
91 requires: [
92 'model', 'model-list', 'juju-endpoints', 'juju-charm-models'],
93 fullpath: '/juju-ui/models/models.js'
94 },
95
96 // Connectivity
97 'juju-env': {
98 requires: ['reconnecting-websocket'],
99 fullpath: '/juju-ui/store/env.js'
100 },
101
102 'juju-notification-controller': {
103 fullpath: '/juju-ui/store/notifications.js'
104 },
105
106 'juju-charm-store': {
107 requires: ['juju-charm-id'],
108 fullpath: '/juju-ui/store/charm.js'
109 },
110
111 'juju-controllers': {26 'juju-controllers': {
112 use: ['juju-env', 'juju-charm-store',27 use: ['juju-env', 'juju-charm-store', 'juju-notification-controller']
113 'juju-notification-controller']
114 },
115
116 // App
117 'juju-gui': {
118 fullpath: '/juju-ui/app.js',
119 requires: [
120 'juju-controllers',
121 'juju-views',
122 'juju-models',
123 'juju-view-charm-search'
124 ]
125 }28 }
126 }29 }
127 }30 }
12831
=== added file 'bin/merge-files'
--- bin/merge-files 1970-01-01 00:00:00 +0000
+++ bin/merge-files 2012-11-09 20:53:21 +0000
@@ -0,0 +1,75 @@
1#!/usr/bin/env node
2
3/**
4 * We aggregate and minimize the js sources in order to improve the load speed
5 * of the application.
6 *
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
9 * firewall without access to the internet.
10 *
11 * The final product will provide three js files: one for the YUI dependencies,
12 * one for our custom js code and one for third party js like d3.
13 *
14 * Known issues:
15 * (1) If we set "bootstrap=false" in the GlobalConfig object, yui disables the
16 * loader object. It means it wont even try to download modules. We cannot
17 * do it because the loader also manages the "use" property which defines
18 * aliases for some of your modules ('juju-views' and 'juju-controllers').
19 * (2) During development, we've noticed that some of the yui modules weren't
20 * included in the list of yui files (lang/datatype-date-format_en-US,
21 * parallel, app-transitions-native, gallery-markdown, loader-base). For
22 * some reason, the loader does not resolve the names of the files for
23 * these modules. We need to add them manually in this file.
24 */
25
26'use strict';
27
28require('yui').YUI().use(['yui'], function(Y) {
29 var merge = require('../lib/merge-files.js'),
30 syspath = require('path'),
31 paths,
32 reqs;
33
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
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
38 // module './app/config.js'" from node's internal module.js file.
39 paths = merge.readdir(syspath.join(process.cwd(), './app'),
40 [syspath.join(process.cwd(), './app/assets'), './app/modules-debug.js']);
41
42 // Get the name of all the YUI modules that our custom js files use directly.
43 reqs = merge.loadRequires(paths);
44
45 // For some reason the loader does not get these requirements.
46 // (Known issue #2)
47 reqs.push('lang/datatype-date-format_en-US');
48 reqs.push('parallel');
49 reqs.push('app-transitions-native');
50 reqs.push('gallery-markdown');
51 reqs.push('loader-base');
52
53 // Get all of the YUI files and their dependencies, and combine them.
54 merge.combine(merge.getYUIFiles(reqs),
55 './app/assets/javascripts/generated/all-yui.js', true);
56
57 // Combine third party js libraries
58 merge.combine([ './app/assets/javascripts/d3.v2.min.js',
59 './app/assets/javascripts/reconnecting-websocket.js',
60 './app/assets/javascripts/svg-layouts.js' ],
61 './app/assets/javascripts/generated/all-third.js', true);
62
63 // Now we only need to generate the file that is used to tell YUI where all
64 // the dependencies are. We either use a debug version or the production
65 // version. The debug version is simply pointers to the individual files.
66 // The production version aggregates all of the files together.
67
68 // Creating the combined file for the modules-debug.js and config.js files
69 merge.combine([ './app/modules-debug.js', './app/config.js' ],
70 './app/assets/javascripts/generated/all-app-debug.js', false);
71
72 // Creating the combined file for all our files. Note that this includes
73 // app/modules.js in the rollup, which is why that file still needs exist.
74 merge.combine(paths, './app/assets/javascripts/generated/all-app.js', true);
75});
0\ No newline at end of file76\ No newline at end of file
177
=== modified file 'grunt.js'
--- grunt.js 2012-10-30 11:36:00 +0000
+++ grunt.js 2012-11-09 20:53:21 +0000
@@ -11,7 +11,7 @@
1111
12 },12 },
13 files: {13 files: {
14 'bin' : 'app/assets/images/*'14 'bin': 'app/assets/images/*'
15 }15 }
16 }16 }
17 }17 }
1818
=== added file 'lib/merge-files.js'
--- lib/merge-files.js 1970-01-01 00:00:00 +0000
+++ lib/merge-files.js 2012-11-09 20:53:21 +0000
@@ -0,0 +1,137 @@
1'use strict';
2
3// We need the yui name to be available in all modules (as a global variable).
4// This only happens if we remove the 'var' keyword or add it to the "global"
5// variable.
6global.YUI = require('yui').YUI;
7
8YUI().use(['yui'], function(Y) {
9 var fs = require('fs'),
10 syspath = require('path'),
11 compressor = require('node-minify');
12
13 function minify(file) {
14 var execution = new compressor.minify(
15 { type: 'uglifyjs',
16 fileIn: file,
17 fileOut: file,
18 callback: function(err) {
19 if (err) {
20 console.log(err);
21 }
22 }});
23 }
24 exports.minify = minify;
25
26 // It combines the files defined by "files" into a single (compressed or not)
27 // js file.
28 function combine(files, outputFile, shouldMinify) {
29 var str = [];
30 Y.Array.each(files, function(file) {
31 console.log('file -> ' + file);
32 str.push(fs.readFileSync(file, 'utf8'));
33 });
34 fs.writeFileSync(outputFile, str.join('\n'), 'utf8');
35 if (shouldMinify) {
36 minify(outputFile);
37 }
38 }
39 exports.combine = combine;
40
41 // It gets the name of all the files under 'path', recursively. It ignores
42 // files and directories included in the "ignore" array. These will
43 // typically be set to ignore our assets and our module file.
44 function readdir(path, ignore) {
45 var result = [], // These are the filenames we will return.
46 dirs = [], // These are the directories into which we will recurse.
47 files = fs.readdirSync(path);
48
49 Y.Array.each(files, function(value) {
50 var fileName, file;
51 fileName = path + '/' + value;
52 file = fs.statSync(fileName);
53 if (file.isFile()) {
54 if (syspath.extname(fileName).toLowerCase() === '.js') {
55 if (ignore && ignore.indexOf(fileName) >= 0) {
56 console.log('SKIPPING FILE -> ' + fileName);
57 } else {
58 result.push(fileName);
59 }
60 }
61 } else if (file.isDirectory()) {
62 console.log('DIRECTORY -> ' + fileName);
63 if (ignore && ignore.indexOf(fileName) >= 0) {
64 console.log('SKIPPING DIRECTORY -> ' + fileName);
65 } else {
66 dirs.push(fileName);
67 }
68 }
69 });
70 // We have read all the filenames and all the directory names. Now
71 // it is time to recurse into the directories that we have collected.
72 Y.Array.each(dirs, function(directory) {
73 // This is the best Javascript offers for appending one array to
74 // another.
75 result.push.apply(result, readdir(directory));
76 });
77 return result;
78 }
79 exports.readdir = readdir;
80
81 // It reads the YUI 'requires' attribute of all our custom js files
82 // (as assembled by readdir) and returns the YUI modules on which we
83 // directly depend.
84 function loadRequires(paths) {
85 var originalAdd, modules, yuiReqs;
86 modules = {};
87
88 originalAdd = YUI.add;
89 // This is a trick to get the 'requires' value from the module
90 // definition.
91 YUI.add = function(name, fn, version, details) {
92 if (details && details.requires) {
93 modules[name] = details.requires;
94 }
95 };
96
97 Y.Array.each(paths, function(path) {
98 // It triggers the custom 'add' method above
99 require(path);
100 });
101 YUI.add = originalAdd;
102
103 // Getting all the YUI dependencies that we need
104 yuiReqs = [];
105 Y.Object.each(modules, function(requires) {
106 Y.Array.each(requires, function(value) {
107 if (!modules[value]) {
108 // This is not one of our modules but a yui one.
109 if (yuiReqs.indexOf(value) < 0) {
110 // avoid duplicates
111 yuiReqs.push(value);
112 }
113 }
114 });
115 });
116 return yuiReqs;
117 }
118 exports.loadRequires = loadRequires;
119
120 // Using the example http://yuilibrary.com/yui/docs/yui/loader-resolve.html
121 // Given a list of direct YUI requirements, return the filenames of these
122 // modules and their dependencies (indirect and direct).
123 function getYUIFiles(reqs) {
124 var loader, out;
125 // The loader automatically handles following our dependencies.
126 loader = new Y.Loader({
127 // The base tells the loader where to look for the YUI files. We
128 // look directly in the npm YUI package, but we could just as well look
129 // in the symbolic link app/assets/javascripts/yui.
130 base: './node_modules/yui/',
131 ignoreRegistered: true,
132 require: reqs});
133 out = loader.resolve(true);
134 return out.js;
135 }
136 exports.getYUIFiles = getYUIFiles;
137});
0138
=== modified file 'lib/server.js'
--- lib/server.js 2012-10-02 11:29:56 +0000
+++ lib/server.js 2012-11-09 20:53:21 +0000
@@ -5,6 +5,7 @@
5 fs = require('fs'),5 fs = require('fs'),
6 path = require('path'),6 path = require('path'),
7 config = require('../config').config.server,7 config = require('../config').config.server,
8 debugMode = (String(process.argv[2]).toLowerCase() === 'debug'),
8 public_dir = config.public_dir,9 public_dir = config.public_dir,
9 Templates = require('./templates.js'),10 Templates = require('./templates.js'),
10 view = require('./view.js');11 view = require('./view.js');
@@ -46,8 +47,24 @@
46 });47 });
47});48});
4849
49server.get('/config.js', function(req, res) {50server.get('/assets/all-third.js', function(req, res) {
50 res.sendfile('app/config.js');51 res.sendfile('app/assets/javascripts/generated/all-third.js');
52});
53
54server.get('/assets/modules.js', function(req, res) {
55 if (debugMode) {
56 res.sendfile('app/assets/javascripts/generated/all-app-debug.js');
57 } else {
58 res.sendfile('app/assets/javascripts/generated/all-app.js');
59 }
60});
61
62server.get('/assets/yui.js', function(req, res) {
63 if (debugMode) {
64 res.sendfile('app/assets/javascripts/yui/yui/yui-debug.js');
65 } else {
66 res.sendfile('app/assets/javascripts/generated/all-yui.js');
67 }
51});68});
5269
53server.get('*', function(req, res) {70server.get('*', function(req, res) {
5471
=== modified file 'package.json'
--- package.json 2012-10-30 11:33:21 +0000
+++ package.json 2012-11-09 20:53:21 +0000
@@ -30,7 +30,8 @@
30 "graceful-fs": "1.1.x",30 "graceful-fs": "1.1.x",
31 "rimraf": "2.0.x",31 "rimraf": "2.0.x",
32 "grunt": ">=0.2.0",32 "grunt": ">=0.2.0",
33 "node-spritesheet": ">=0.2.3"33 "node-spritesheet": ">=0.2.3",
34 "node-minify": "0.5.0"
34 },35 },
35 "optionalDependencies": {}36 "optionalDependencies": {}
36}37}
3738
=== modified file 'test/index.html'
--- test/index.html 2012-11-01 13:12:28 +0000
+++ test/index.html 2012-11-09 20:53:21 +0000
@@ -4,7 +4,7 @@
4 <meta charset="utf-8">4 <meta charset="utf-8">
5 <link rel="stylesheet" href="assets/mocha.css">5 <link rel="stylesheet" href="assets/mocha.css">
6 <script src="../app/assets/javascripts/yui/yui/yui-debug.js"></script>6 <script src="../app/assets/javascripts/yui/yui/yui-debug.js"></script>
7 <script src="../app/modules.js"></script>7 <script src="../app/modules-debug.js"></script>
8 <script src="assets/chai.js"></script>8 <script src="assets/chai.js"></script>
9 <script src="assets/mocha.js"></script>9 <script src="assets/mocha.js"></script>
10 <script src="utils.js"></script>10 <script src="utils.js"></script>

Subscribers

People subscribed via source and target branches