如何将config.assets.precompile用于目录而不是单个文件? [英] How do I use config.assets.precompile for directories rather than single files?

查看:66
本文介绍了如何将config.assets.precompile用于目录而不是单个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在生产环境中使用config.assets.precompile仅将文件包含在"lib/assets/javascripts","lib/assets/stylesheets","vendor/assets/javascripts"和"vendor/assets/stylesheets"中'?

How do I use config.assets.precompile in production to only include the files in 'lib/assets/javascripts', 'lib/assets/stylesheets', 'vendor/assets/javascripts' and 'vendor/assets/stylesheets'?

基本上类似于:

config.assets.precompile += %w( pagespecific.js anotherpage.js )

但是用于自动将文件包含在不是"app/assets/javascripts"或"app/assets/stylesheets"的特定目录中.

But used to auto include files in specific directories that are not 'app/assets/javascripts' or 'app/assets/stylesheets'.

* edit:添加我最终用于页面特定js的解决方案

*edit: adding the solution I ended up using for page specific js

config.assets.precompile += ['pages/*.js']

推荐答案

您可以像这样简单地编写它:

You can simply write it like this:

config.assets.precompile += ['directory/*']

这篇关于如何将config.assets.precompile用于目录而不是单个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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