Skip to content

Loading…

Support for splitting packaging into more than just javascripts.js #2

Closed
coreyhaines opened this Issue · 3 comments

2 participants

@coreyhaines

Problems:

  • The scripts in my application are getting larger, which means that the javascript.js file is getting very large.
  • The general cache includes all my script files, even though some larger ones are only used on specific pages

proposed solution:
When adding the middleware, allow configuration to set key->directory pairs that would then get packaged up independently. When I want to reference one, I would add the key to the call in the view.

This also means that we would need to not do auto-configuration of the middleware, instead configuring in application.rb.

I'm working on a patch for this.

@coreyhaines

So, after some investigation and a couple specs, I find that I can do this almost out of the box, if I split my scripts into other directories besides javascript and add the directory names as handlers. There are only two changes that are needed.

  • The ability to pass the filename/key into the #asset_resource_javascripts call. I'm going to add some specs for passing that in, then push.
  • Take out auto-registering of the middleware (ActiveSupport.on_load(:before_configuration in rails3.rb), instead do it in application.rb, so other handlers can be passed in.
@coreyhaines

So, using my fork, it is working so far. The only change was to allow passing in a different name for the resource referenced in the script tag in the view. That name resolves to a directory on the filesystem.

@ddollar
Owner

Hello. I apologize for the delayed response. I am currently declaring issue bankruptcy. If this issue still applies to you please feel free to re-open and explain. Thanks :)

@ddollar ddollar closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.