How to use Rails 5.1.0 and jQuery

I started using Rails v5.1.0, which, as I understand it, comes without jQuery by default, however I want to install jQuery to work with Zurb Foundation 6.

What is the best way to set this as a basis for not currently loading modals?

+4
source share
2 answers

Summary:

  • Set yarn
  • yarn add jquery
  • Add jquery to application.js manifest file

~~~

Today I ran into this problem.

ActionCable 5.1 , JQuery - Yarn, javascript (Think Gemfile Bundler, javascript).

Rails 5.1 : bin/yarn. , , " ":

Download Yarn at https://yarnpkg.com/en/docs/install

  • Mac, brew install yarn.

  • Chocolatey Windows, choco install yarn.

  • Linux " sudo apt-get install yarn. , .

, , :

yarn add jquery

jquery .js: package.json. "Javascript Gemfile", - "Bundler".

, jquery , .

//= require jquery
//= require rails-ujs
//= require turbolinks
//= require bootstrap
//= require_tree .

. Javascript Rails.

+26

jQuery javascript, , //= require jquery app/assets/javascripts/application.js, jquery. jQuery app/assets/javascripts, CDN.

+1

Source: https://habr.com/ru/post/1675988/


All Articles