mkhairi / materialize-sass

Materializecss rubygem for Rails Asset Pipeline / Sprockets
http://materialize.labs.my/
MIT License
806 stars 243 forks source link

$ Undefined #148

Closed jamesstonehill closed 7 years ago

jamesstonehill commented 7 years ago

I'm using Rails 5.1.0

This is my manifest file

//= require rails-ujs
//= require turbolinks
//= require materialize-sprockets
//= require_tree .

But I'm getting this error in the console whenever I open my app.

Uncaught ReferenceError: $ is not defined
    at initial.source-79f269e….js:9

How can I get around this without re-importing jQuery?

mkhairi commented 7 years ago

add

# Use jquery as the JavaScript library
gem 'jquery-rails'

on your Gemfile

or via yarn if you using rails 5.1.* with webpacker

yarn add jquery

then

add on your application.js

//= require jquery