2014-01-31 30 views
4

我本地預編譯資產like this RAILS_ENV =產品包的exec耙資產:預編譯,但它太減慢12小時。我不知道會發生什麼!我不知道如何開始做一些事情。 此外,當我在一些樣式表文件進行更改,這些延遲10秒左右Rails的資產預編譯太慢〜12小時

請任何人都可以幫助我,謝謝!

這是我applications.css.scss

@import "_font-awesome"; 
@import "jquery.ui.core"; 
@import "jquery.ui.theme"; 
@import "dataTables/src/demo_table_jui"; 
@import "token-input-facebook"; 
@import "fullcalendar"; 
@import "fullcalendar.print"; 

@import "bootstrap"; 
@import "bootstrap-multiselect"; 
@import "bootstrap-datetimepicker"; 

@import "header"; 
@import "sub_header"; 
@import "students"; 
@import "people"; 
@import "institutions"; 

我的Gemfile:

gem 'sass-rails', '>= 3.2' 
gem 'bootstrap-sass', '~> 3.0.3.0' 

其版本:

bootstrap-sass (3.0.3.0) 
sass (3.2.12) 
sass-rails (3.2.6) 

附加信息:

rails 3.2.16 
ruby 1.9.3 

UPDATE1

My complete Gemfile

UPDATE2

當我把禁用資產壓縮config.assets.compress = false,在生產模式下,我得到它的結果:

real 5m13.113s 
user 5m5.355s 
sys  0m5.268s 

UPDATE3

得到了改善,但沒有解決方案。

  • 我改變css_compresor,現在,我使用:yui
  • 我更改application.css.scss贊成使用Sprockets require指令。

現在這是我的application.css.scss file

預編譯它的時間是:〜24分鐘

+13

**12小時**,嚴重? –

+0

是的!,它是瘋了 – edudepetris

+0

你能給我們整個Gemfile嗎? – marvelousNinja

回答

2

我解決了這個問題:

的問題是在我.scss文件中使用@extend句子。 此問題出現在此sass版本中。

我想要更多的語義html文件(關於它的更多信息READ HERE)。

我發現這個問題讓自省進入Sprockets預編譯。隨着this偉大的教程

解決方案是從我的scss文件中取下所有@extend句子,並在我的html中使用普通bootstrap。例如:我不得不改變這一點。

# main.html 
<div class='user-information'> ... </div> 
# main.scss 
.user-information { 
    @extend .col-md-12 
} 

通過這樣的:

# main.html 
<div class='col-md-12'> ... </div> 
1

檢查了這一點,你的問題的根源可能是相似的(即@import慢):https://gist.github.com/noniq/1746744

我們有7分鐘的資產編譯時間在最快的i7 Macbook Pro上。使用上面的黑客將它縮短到2分鐘以上。原來,我們使用羅盤很差,甚至更好的解決方案是隻在必要時才導入它,並且只在給定的scss部分中導入我們需要的指南針的特定部分。即使是導入羅盤的空白scss文件也需要大約2秒才能編譯,而且由於我們有很多很多的部分,所以它加起來了。