netzke / netzke-core

Framework for Sencha Ext JS + Ruby on Rails client-server components
http://netzke.org
Other
263 stars 77 forks source link

Compatibility with Rails asset pipeline or a CDN #52

Closed amalagaura closed 8 years ago

amalagaura commented 11 years ago

Right now I am only able to load javascripts from /public. I am unable to load from vendor/assets or from the CDN at : http://cdn.sencha.io/ext-4.1.0-gpl/

I used an initializer as follows:

Netzke::Core.setup do |config|
  config.ext_uri = 'assets'
end
Netzke::Core.setup do |config|
  config.ext_uri = 'http://cdn.sencha.io/ext-4.1.0-gpl'
end

using 'assets' as a prefix causes a linktag of: http://localhost:3000/assets/assets/ext-all-debug.js

expecting it to be: http://localhost:3000/assets/ext-all-debug.js

Using the CDN gives the following, no .js because it does not find the JS file: http://cdn.sencha.io/ext-4.1.0-gpl/ext-all-debug

(should be http://cdn.sencha.io/ext-4.1.0-gpl/ext-all-debug.js)

I think the best way is to support config.action_controller.asset_host

_uri if present would override using the asset_host based link tags.

Otherwise we should specify a prefix (with a default of 'assets') so that files can be put in /vendor/assets as Rails guides recommends. Using public is deprecated with the Rails asset pipeline.

mxgrn commented 11 years ago

Thanks for pointing it out. This aspect of Netzke certainly needs a rework.

Btw, this:

Netzke::Core.setup do |config| config.ext_uri = 'http://cdn.sencha.io/ext-4.1.0-gpl' end

will work properly in Core 0.8.2 (edge). But unfortunately Basepack still relies on Ext JS files being located in public.

mxgrn commented 8 years ago

This is working in the later versions. Closing.