如何在开发模式下显示生产中加载的CSS / JS Rails资产?

时间:2023-01-15 23:19:07

When I open my Rails app and display the generated HTML code, I see there every single CSS file that is loaded.

当我打开我的Rails应用程序并显示生成的HTML代码时,我看到每个加载的CSS文件。

In production mode I see only on application.css file where is everything.

在生产模式中,我只看到application.css文件,其中包含所有内容。

How to display the same statement that is in the development mode also in production?

如何在生产中显示处于开发模式的同一语句?

The reason why I want to do that is, that the CSS structure of the application looks differently on my localhost and on Amazon AWS. I prepared all CSS for the app locally, where was everything pixel-perfect prepared, but when I deployed the code to AWS, the app looks different - font (from Google fonts) is bigger (although I see there is used the same size), the same for some DIVs... don't know how to figure this out, so trying to inspect all loaded CSS files.

我想这样做的原因是,应用程序的CSS结构在我的localhost和Amazon AWS上看起来不同。我在本地准备了应用程序的所有CSS,其中所有内容都是像素完美准备的,但是当我将代码部署到AWS时,应用程序看起来不同 - 字体(来自Google字体)更大(尽管我看到使用相同的大小) ,对于一些DIV来说也一样......不知道如何解决这个问题,所以试图检查所有加载的CSS文件。

2 个解决方案

#1


0  

Your have to disable asset pipelining from config/environments/production.rb

您必须从config / environments / production.rb禁用资产管道

config.assets.enabled = false

config.assets.enabled = false

#2


0  

First did you compile the assets during Deployment

首先是在部署期间编译资产

Please read the docs http://guides.rubyonrails.org/asset_pipeline.html

请阅读文档http://guides.rubyonrails.org/asset_pipeline.html

For development style css files You might want to set these

对于开发样式css文件您可能想要设置这些文件

config.assets.compress = false config.assets.debug = true

config.assets.compress = false config.assets.debug = true

NOTE: Dont use these permanently its just to start with asset pipeline or debug

注意:不要永久使用它,只是从资产管道或调试开始

#1


0  

Your have to disable asset pipelining from config/environments/production.rb

您必须从config / environments / production.rb禁用资产管道

config.assets.enabled = false

config.assets.enabled = false

#2


0  

First did you compile the assets during Deployment

首先是在部署期间编译资产

Please read the docs http://guides.rubyonrails.org/asset_pipeline.html

请阅读文档http://guides.rubyonrails.org/asset_pipeline.html

For development style css files You might want to set these

对于开发样式css文件您可能想要设置这些文件

config.assets.compress = false config.assets.debug = true

config.assets.compress = false config.assets.debug = true

NOTE: Dont use these permanently its just to start with asset pipeline or debug

注意:不要永久使用它,只是从资产管道或调试开始