Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javascript_asset_path directly don't work #256

Open
eduardolagares opened this issue Jun 18, 2018 · 1 comment
Open

javascript_asset_path directly don't work #256

eduardolagares opened this issue Jun 18, 2018 · 1 comment

Comments

@eduardolagares
Copy link

eduardolagares commented Jun 18, 2018

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 ?

@fanfan1609
Copy link

fanfan1609 commented Dec 6, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants