链轮和导轨 3 - 添加一个新的预编译 js 文件 [英] Sprockets and rails 3 - adding a new precompiled js file

查看:30
本文介绍了链轮和导轨 3 - 添加一个新的预编译 js 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个文件 app/assets/javascripts/application.js,其中有一个需求列表,当我运行 rake assets:precompile清理、缩小所有列出的文件并将其连接到 public/assets/application.js 中.一切正常.

I currently have a file app/assets/javascripts/application.js which has a list of requires in it, and which, when i run rake assets:precompile cleans, minifies and concatenates all of the listed files into public/assets/application.js. That's all working fine.

但是,我想添加另一个名为show_tale.js"的预编译 js 文件,其中包含要拉入的不同 js 文件列表.我已将 show_tale.js 文件添加到 app/assets/javascripts 里面有需求列表.但是,当我执行 rake assets:precompile 时,它不会像我想要的那样构建 public/assets/show_tale.js 文件.

However, i want to add another precompiled js file called 'show_tale.js', with a different list of js files to pull in. I've added a show_tale.js file into app/assets/javascripts which has the list of requires in it. But, when i do rake assets:precompile, it doesn't build a public/assets/show_tale.js file like i want it to.

我猜在某些配置文件中,我需要将show_tales"或show_tales.js"添加到某个列表或选项中,但我不知道在哪里/如何执行此操作.谁能让我直截了当?

I'm guessing that in some config file i need to add 'show_tales' or 'show_tales.js' into some list or option, but i can't work out where/how to do this. Can anyone set me straight?

谢谢,最大

推荐答案

找到了,真的很明显.这是漫长的一周 :) 在 config/environments/production.rb 中:

Found it, it was pretty obvious really. It's been a long week :) In config/environments/production.rb:

config.assets.precompile += %w( show_tale.js )

这篇关于链轮和导轨 3 - 添加一个新的预编译 js 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆