Cookiejest Cookiejest - 2 months ago 5x
Javascript Question

cannot find //=require jquery.nouislider in application.css

Im trying to use a few slider gems and I keep bumping into the same problem,

I follow the instructions to put in app/assets/javascript manifest file:

//=require jquery.nouislider

In the app/assets/stylesheets manifest file:

//=require jquery.nouislider

I have also installed the gem. However I keep getting error messages that say:

Showing /home/ubuntu/foodin/app/views/layouts/application.html.erb where line #8 raised:
couldn't find file 'jquery.nouislider'
(in /home/ubuntu/foodin/app/assets/stylesheets/application.css:16)

<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>

I think this might be related to the asset pipeline but im not sure. Any ideas? Thanks for the help!

EDIT: This is my development.rb config file incase its something to do with that:

Foodin::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false

# Do not eager load code on boot.
config.eager_load = false

# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false

# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise an error on page load if there are pending migrations
config.active_record.migration_error = :page_load

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true

#NEW: Added for Devise
config.action_mailer.default_url_options = { :host => 'localhost:3000' }

#New:Added for development
config.serve_static_assets = false



In the app/assets/stylesheets/application.css it should be

*= require jquery.nouislider

and not

//= require jquery.nouislider

and try to replace Gemfile declarations with;

gem 'jquery-nouislider-rails', '~>' specifying the version and restart server

Working setup

I simple downloaded nonuislider here and added it to app/assets/javascripts folder then called it in application.js as you had done before and it worked. Maybe there is something wrong with the Gem.