gpt4 book ai didi

javascript - 在 application.css 中找不到//=require jquery.nouislider

转载 作者:行者123 更新时间:2023-11-28 17:41:10 25 4
gpt4 key购买 nike

我尝试使用一些 slider gem,但我一直遇到同样的问题,

https://github.com/soycamo/jquery-nouislider-rails

我按照说明放入 app/assets/javascript list 文件:

//=需要jquery.nouislider

在 app/assets/stylesheets list 文件中:

//=需要jquery.nouislider

我也安装了 gem。但是我不断收到错误消息:

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 %>

我认为这可能与 Assets 管道有关,但我不确定。有任何想法吗?感谢您的帮助!

编辑:这是我的 development.rb 配置文件,以防与此有关:

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

end

最佳答案

在 app/assets/stylesheets/application.css 中应该是

*= require jquery.nouislider

不是

//= require jquery.nouislider

并尝试将 Gemfile 声明替换为;

gem 'jquery-nouislider-rails', '~> 4.0.1.1' 指定版本并重启服务器

工作设置

我简单downloaded nonuislider here并将其添加到 app/assets/javascripts 文件夹,然后像您之前所做的那样在 application.js 中调用它并且它起作用了。可能 Gem 有问题。

关于javascript - 在 application.css 中找不到//=require jquery.nouislider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24096467/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com