It would be cool to have something like "dynamic packages" supported. We need this feature for packaging assets for different accout types and user levels multiplied with different booked packages.. No fun to "pre-" configure this.
We've build a "desktop class" application with several hundreds of js files. A normal user downloads about 400 js scripts (ofc bundled to one in production). This can be up to 800 scripts. The bundled and compressed script is still about 1-2 mb (without libs). Also a script can require css, flash and java applets. You might agree that it is not an option for us to provide all scripts to all users at once.
What we have in production is jsrequire [1] for js dependency management (quiet similar to Sprockets [2], but more flexible (see loadpaths -> webpath helper, customizable hooks)) and a (very small) patched version of jammit [3] for bundeling with an interchanged Jammit::Packager. Enough written, here is a little code how we did it:
Jammit.configured_packager = :dynamic_packager
class DynamicPackager < Jammit::Packager
def not_found(package, extension)
dynamic_package_for(package, extension) || super
end
def dynamic_package_for(package, extension)
# app specific code
end
end
Hope you understand the needs of "dynamic packages" for us. Is this a way for jammit? Other ideas or solutions on that problem? Thanks.
It would be cool to have something like "dynamic packages" supported. We need this feature for packaging assets for different accout types and user levels multiplied with different booked packages.. No fun to "pre-" configure this.
We've build a "desktop class" application with several hundreds of js files. A normal user downloads about 400 js scripts (ofc bundled to one in production). This can be up to 800 scripts. The bundled and compressed script is still about 1-2 mb (without libs). Also a script can require css, flash and java applets. You might agree that it is not an option for us to provide all scripts to all users at once.
What we have in production is jsrequire [1] for js dependency management (quiet similar to Sprockets [2], but more flexible (see loadpaths -> webpath helper, customizable hooks)) and a (very small) patched version of jammit [3] for bundeling with an interchanged Jammit::Packager. Enough written, here is a little code how we did it:
Jammit.configured_packager = :dynamic_packager
Hope you understand the needs of "dynamic packages" for us. Is this a way for jammit? Other ideas or solutions on that problem? Thanks.
[1] http://github.com/aekym/jsrequire [2] http://getsprockets.org/ [3] http://github.com/aekym/jammit/tree/0.4.4.aekym