jquery-rails icon indicating copy to clipboard operation
jquery-rails copied to clipboard

javascript_asset_path directly don't work

Open eduardolagares opened this issue 6 years ago • 1 comments

In my login page i need to use a javascript_include_tag calling the jquery.js. I know that is not usually but in this case i don't need to load all my app javascript on this page.

The javascript_include_tag is on a gem called alego_permissoes (local project gem)

<%= javascript_include_tag('jquery') %>

My precompile is configured to generate jquery:

# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.precompile += %w( jquery.js )

When i run rake assets:precompile it returns success but don't create jquery file in my public/assets.

Ruby: 2.3.0 Gems: gem 'rails', '4.2.5' gem 'jquery-rails', "2.0.3" gem 'jquery-ui-rails', '6.0.1'

Running in development the asset was load, but any other env that use config.assets.debug false it work.

There is any restriction to call jquery from this gem out of application.js using require ?

eduardolagares avatar Jun 18 '18 18:06 eduardolagares

You don't need to add like that.

Open the app/assets/javascripts/application.js and add //= require jquery

After that, restart the Rails server

fanfan1609 avatar Dec 06 '18 03:12 fanfan1609