Asset management #361

wants to merge 14 commits into


None yet
2 participants

ben-ng commented May 17, 2013

First stab at this, coming from #292.

Moved stuff from the public folder into assets. There's a packages.json file in there that tells geddy how to package together the assets. I just use the file extension to decide how to deal with files.

If a file in the assets directory is not used as part of a package, it's copied over to the public folder (e.g. images).

Added a jake task jake assets that will compile the assets using lib/assetcompiler.js. Also added a bunch of dependencies to the stock package.json.

Stuff I'm unsure about:

  • Are we going to watch files?
  • Should this be a jake task or part of the geddy cli?

Stuff that still needs to be done

  • Minification should only happen in production mode
  • Assets should be placed into a folder with a hash of some sort. Need to think of a fast way to do this without recompiling everything (takes a couple secs, annoying).
  • Probably shouldn't use console.log()...
  • Tests

Let me know what you guys think.


ben-ng commented May 17, 2013

Felt good tonight, added LESS support (#290) and switched over to the LESS version of Bootstrap. Asset compilation doesn't take significantly longer.

The only tricky bit is that since LESS files can import other files, we can't easily tell what files don't have to be copied over to the public folder because they were already included in another stylesheet.

I excluded all .less files from the copying process to solve this problem. Shouldn't be a issue since you'd always have a rule in packages.json to compile your master LESS file anyway. We need to document this somewhere though.


ben-ng commented May 19, 2013

This PR is a mess so I'm closing it. I really shouldn't have left the flash stuff in here.

I pulled the asset management code into it's own module because there are other modules out there that might already to this better. One is brewer.js.

Going to rethink this a little and submit a better revision soon.

@ben-ng ben-ng closed this May 19, 2013

@ben-ng ben-ng deleted the ben-ng:asset-management branch May 19, 2013


mde commented May 20, 2013

Thanks for the work on this! Definitely don't let a little mess stop you. If you can't get a reasonable start on a revision pretty soon, let's work together on cleaning this up.


ben-ng commented May 20, 2013

@mde i'll try and catch you on IRC before i submit a revision. in the meantime can you see if #364 looks okay? Besides needing it for my own app, it would be a good place to set up assets on app launch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment