本文介绍了Rails 2.3中的链轮/资产管道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照以下非常详尽的说明将链轮/资产管道添加到我正在处理的旧版Rails 2.3.18应用程序中:

I've followed the very thorough instructions below to add sprockets/asset pipeline to a legacy Rails 2.3.18 application I'm working on:

http://jaredonline.github.io/blog/2012/05/16/sprockets-2-with-rails-2-dot-3/

我有一个未解决的问题-在我的vendor/assets/stylesheets/bootstrap目录中,我已经从sass-bootstrap gem中复制了所有.scss文件.

I have one outstanding issue -- in my vendor/assets/stylesheets/bootstrap dir, I have copied all of the .scss files from the sass-bootstrap gem.

当我运行上述URL rake assets:precompile中提供的rake任务时,它会因以下错误而出错: https://github.com/thomas-mcdonald/bootstrap-sass/issues/378

When I run the rake task provided in the above URL, rake assets:precompile, it errors out with this error: https://github.com/thomas-mcdonald/bootstrap-sass/issues/378

问题是链轮正在尝试编译部分.scss文件,这些文件应仅编译到main.css主文件中.

The issue is that sprockets is trying to compile some partial .scss files, which should just be compiled into the main application.css file.

由于我无法在2.3.18中更改config.assets.precompile Rails配置,因此如何建议我告诉链轮忽略单独编译这些部分.scss文件?

Since I don't have the ability to change the config.assets.precompile Rails configuration in 2.3.18, how do you recommend I tell sprockets to ignore compiling these partial .scss files individually?

推荐答案

@joris提供了很好的见识,但是当您回答时,我已经知道了!

@joris provided good insight, but I had already figured it out by the time you replied!

assets.rake#internal_precompile内部,将最后一行更改为:

Inside assets.rake#internal_precompile, change the last line to:

manifest.compile [ Proc.new { |path| !%w(.js .css).include?(File.extname(path)) }, /application.(css|js)$/ ]

在此页面的下方找到了该答案: http://guides.rubyonrails .org/asset_pipeline.html#precompiling-assets

Found this answer a little ways down on this page: http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets

这篇关于Rails 2.3中的链轮/资产管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 14:02