即使链接存在于rails应用程序中,链接也无法归档资产

时间:2017-04-20 13:49:58

标签: ruby-on-rails sprockets

我对链轮有一个非常有趣的问题。首先,这是我得到的以下错误消息。

couldn't find file 'jquery.themepunch.plugins.min' with type 'application/javascript'
Checked in these paths: 

enter image description here

这是有趣的部分。它说无法找到javascript插件,但问题是由第13行引起的,其中包含 stylesheet_link_tag 。怎么可能呢?

无论如何,我有 frontend.js frontend.css 文件。这是文件的内容。

frontend.css

/*
 *= require css/style
 *= require css/colors/red
 *= require_self
 */

frontend.js

// require scripts/jquery.themepunch.plugins.min
// require scripts/jquery.themepunch.revolution.min
// require scripts/jquery.themepunch.showbizpro.min
// require scripts/jquery.easing.min
// require scripts/jquery.tooltips.min
// require scripts/jquery.magnific-popup.min
// require scripts/jquery.superfish
// require scripts/jquery.flexslider
// require scripts/jquery.jpanelmenu
// require scripts/jquery.isotope.min
// require scripts/custom

我故意将// =更改为//以取消javascript插件的包含。

编辑1: 这是我的资产路径:

[1] pry(main)> Rails.application.config.assets.paths
=> ["/ssd/Projects/my_app/app/assets/fonts",
 "/ssd/Projects/my_app/app/assets/images",
 "/ssd/Projects/my_app/app/assets/javascripts",
 "/ssd/Projects/my_app/app/assets/stylesheets",
 "/ssd/Projects/my_app/vendor/assets/astrum",
 "/ssd/Projects/my_app/vendor/assets/javascripts",
 "/ssd/Projects/my_app/vendor/assets/metronic_v4.7.5",
 "/ssd/Projects/my_app/vendor/assets/stylesheets",
 "/home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/font-kit-rails-1.2.0/app/assets/fonts",
 "/home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/font-kit-rails-1.2.0/app/assets/stylesheets",
 "/home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jquery-rails-4.3.1/vendor/assets/javascripts",
 "/home/bunyamin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/coffee-rails-4.1.1/lib/assets/javascripts",
 "/ssd/Projects/my_app/vendor/assets/astrum"]

我真的被卡住了。我怎么解决这个问题?有人请帮忙吗?我不需要任何javascript插件,你可以看到,但我找不到文件错误。

1 个答案:

答案 0 :(得分:1)

Sprockets确实没有提供有用的错误消息。我忘记了 assets 文件夹中的 application.js 文件。它会自动运行它,即使我没有打电话。

然后它显示错误消息,就好像样式表文件是原因。

无论如何,在删除application.js之后我的问题就解决了。