Rails - Render asset javascript -



Rails - Render asset javascript -

is there chance render precompiled javascript file? plain file no problem with:

def iframe_communication render file: "/app/assets/javascripts/iframe_communication_module.js" end

i tried assets_path or include javascript_include_tag in view, no succeeds.

for clarification don't want add together script view. seek render javascript file external access (adding <script> tags other domains).

update

render file: "..." shows file expected uncompiled version assets_path "/app/assets/javascripts/iframe_communication_module.js" returns "/app/assets/javascripts/iframe_communication_module.js" , not path compiled asset javascript_include_tag loads script expected (not rendering)

the rails 4 asset pipeline compiles 1 file, there chance single file out of it? or improve way compile manually?

update 2 found this: assets_path don't expected. prepends , appends:

asset_path "application.js" # => /application.js asset_path "application", type: :javascript # => /javascripts/application.js

got working solution:

i don't need file in normal asset pipeline. add together

//= stub iframe_communication_module

to apps/assets/javascript/application.js.

to precompile file automatically add together

config.assets.precompile += %w( iframe_communication_module.js )

to config\application.rb

to access through controller add together

redirect_to actioncontroller::base.helpers.javascript_path("iframe_communication_module")

to controller.

javascript ruby-on-rails-4 assets

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -