简体   繁体   English

rails:资产js清单未拾取特定的js文件

[英]rails: assets js manifest not picking up specific js file

I can't get my prints.js file to get picked up by the manifest (I presume that is the issue.) 我无法将清单中的prints.js文件提取出来(我想这是问题所在。)

this is in the appliction.js manifest: 这是在appliction.js清单中:

//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require 'main'
//= require 'cards'
//= require 'prints'
//= require_tree .

the cards.js has a console log saying hello like this : cards.js有一个控制台日志,像这样打招呼:

$(document).on('turbolinks:load', function() {
  console.log('cards js file executed.')
  ...
});

When I do the same thing for cards.js like this: 当我对cards.js做同样的事情时:

$(document).on('turbolinks:load', function() {
  console.log('Prints js file executed.');
});

the console only calls out the cards.js console log statement, but not prints. 控制台仅调出cards.js控制台日志语句,但不打印。

I restarted rails server, and rebooted my local machine hoping that would pick it up. 我重新启动了Rails服务器,并重新启动了本地计算机,希望能够将其接收。 but no result. 但没有结果。 (Rails 4.2) (第4.2条)

EDIT I am decided to use the application.js for hosting the function I need. 编辑我决定使用application.js来托管我需要的功能。 Though it works, it feels 'cheap' and if anybody has any suggestions of what could make a manifest not include files, that would be greatly appreciated. 尽管它可以工作,但感觉很“便宜”,如果有人对不包含文件的清单有任何建议,将不胜感激。 But I have a temporary solution. 但是我有一个临时解决方案。 在此处输入图片说明

try without quote like following. 尝试不加报价,如下所示。 after change please restart server 更改后,请重新启动服务器

//= require main
//= require cards
//= require prints

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM