在Rails中使用config.assets.precompile在子目录中包含资产 [英] Including assets in subdirectories with config.assets.precompile in Rails

查看:87
本文介绍了在Rails中使用config.assets.precompile在子目录中包含资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Heroku上运行的Rails 3.1.3应用程序,它利用S3通过asset_sync进行资产托管.我的app/assets/css目录中包含一个带有两个文件的子目录:main.css.scsscategories.css.scss.我的production.rb中有以下一行:

I've got a Rails 3.1.3 application running on Heroku, utilizing S3 for asset hosting via asset_sync. Included in my app/assets/css directory is a subdirectory with two files: main.css.scss and categories.css.scss. I have the following line in my production.rb:

config.assets.precompile += [ 'admin/main.css.scss', 'admin/categories.css.scss', 'print.css', 'products.css.scss', 'services.css.scss' ]

当我推送到Heroku时,除了这两个文件之外,我所有的资产都已预编译并上传.我需要执行某种黑魔法以在过程中包括这两个文件吗?

When I push to Heroku, all my assets are precompiled and uploaded with the exception of those two files. Do I need to perform some sort of dark magic to include those two files in the process?

推荐答案

只需键入不带scss的文件名,它将正常工作.

Just type the filenames without scss and it will work fine.

config.assets.precompile += [ 'admin/main.css', 'admin/categories.css', 'print.css', 'products.css', 'services.css' ]

这篇关于在Rails中使用config.assets.precompile在子目录中包含资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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