如何在开发环境中的 rails 中预编译资产? [英] How do I precompile assets in rails in development environment?

查看:42
本文介绍了如何在开发环境中的 rails 中预编译资产?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从命令行手动预编译我的开发环境中的一些资产(以检查已编译的 js 和 css 文件的内容).

I want to manually precompile some assets in my dev environment (to check the content of the compiled js and css files) from the command line.

我在跑步

RAILS_ENV=development bundle exec rake assets:precompile

但是我的 js 和 css 没有在 public/assets 文件夹中编译,只有图像.知道为什么会发生这种情况吗?

but my js and css are not compiled in the public/assets folder, only the images are. Any idea why that may be happening?

推荐答案

尝试将其添加到您的 config/environments/production.rb :

Try adding this to your config/environments/production.rb :

config.assets.precompile += %w( *.css *.js )

这篇关于如何在开发环境中的 rails 中预编译资产?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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