Sprockets and rails 3 - adding a new precompiled js file

半城伤御伤魂 提交于 2019-12-12 18:28:27

问题


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.

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.

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?

thanks, max


回答1:


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 )


来源:https://stackoverflow.com/questions/8272325/sprockets-and-rails-3-adding-a-new-precompiled-js-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!