禁用Asset Pipeline / Sprockets Rails 4.1

时间:2021-12-26 09:47:11

I cannot seem to find a way to disable the Asset Pipeline in Rails 4.1. I see a lot of information for Rails 3.2.

我似乎无法找到在Rails 4.1中禁用资产管道的方法。我看到Rails 3.2的很多信息。

I want to use Grunt/GulpJs and bower to handle all of my assets and I cannot seem to find something for this. Rather I find a decent amount but most of it doesn't apply to me or is broken.

我想用Grunt / GulpJs和bower来处理我的所有资产,我似乎无法找到适合自己的东西。相反,我找到了一个不错的数量,但大多数不适用于我或被打破。

There is the half-pipe gem. However half-pipe relies on Rails 4.0 and I'm on Rails 4.1 and I can't find where to force a Gem to install in different version of Rails, if that's even possible.

有半管宝石。然而,半管道依赖于Rails 4.0,我在Rails 4.1上,我找不到强制Gem在不同版本的Rails中安装的地方,如果可能的话。

This question expanded into a few more questions than I intended. Basically I just need to know how to disable the Asset Pipeline, barring that how to integrate GruntJS.

这个问题扩展到了比我预想的更多问题。基本上我只需要知道如何禁用资产管道,除非如何集成GruntJS。

2 个解决方案

#1


33  

You can disable the asset pipeline in config/application.rb by adding the following line to it :

您可以通过向config / application.rb添加以下行来禁用资产管道:

config.assets.enabled = false

You could also turn off asset pipeline while creating a new rails application by passing the --skip-sprockets option to it:

您还可以通过将--skip-sprockets选项传递给它来创建新的rails应用程序时关闭资产管道:

rails new myappname --skip-sprockets

#2


16  

Add this to your config/application.rb:

将其添加到您的config / application.rb:

config.assets.enabled = false

config.generators do |g|
  g.assets false
end

This will disable the asset pipeline and it will prevent the cli generator from creating assets when generating a scaffold.

这将禁用资产管道,它将阻止cli生成器在生成脚手架时创建资产。

#1


33  

You can disable the asset pipeline in config/application.rb by adding the following line to it :

您可以通过向config / application.rb添加以下行来禁用资产管道:

config.assets.enabled = false

You could also turn off asset pipeline while creating a new rails application by passing the --skip-sprockets option to it:

您还可以通过将--skip-sprockets选项传递给它来创建新的rails应用程序时关闭资产管道:

rails new myappname --skip-sprockets

#2


16  

Add this to your config/application.rb:

将其添加到您的config / application.rb:

config.assets.enabled = false

config.generators do |g|
  g.assets false
end

This will disable the asset pipeline and it will prevent the cli generator from creating assets when generating a scaffold.

这将禁用资产管道,它将阻止cli生成器在生成脚手架时创建资产。