2013-02-20 40 views
3

我在Rails應用程序中運行Galleria.IO的JavaScript庫,並且在開發過程中一切正常,並且在我專門包含Galleria代碼的頁面上生產。但是,當你打的沒有代碼的頁面,它不斷拋出這樣的錯誤Galleria JS不能在Rails流水線生產中工作

No theme CSS loaded 
Fatal error: Theme CSS could not load after 20 sec. Please download the latest theme at http://galleria.io/customer/ 

我已經列入我管線的Galleria文件:

// application.js 
//= require galleria.min 
//= require galleria.classic.min 

/* application.css 
*= require galleria.classic 
*/ 

下面事實上確實初始化畫廊正確的網頁上,那裏是一個#galleria元素,但拋出上述錯誤在其他地方:

if ($("#galleria").length == 1) { 
     Galleria.loadTheme('/assets/galleria.classic.min.js'); 
     Galleria.configure({ 
      debug: false, 
      // imageCrop: true, 
      dummy: '/assets/fallback/large_default.png', 
      transition: 'fade' 
     }); 
     Galleria.run('#galleria'); 
    } 

有沒有辦法有主題加載自動售貨機在資產管道中,而不必單獨初始化它?

回答

3

聽起來像你應該總是加載一個主題!

將在app /資產/ Java腳本/ galleria_setup.js如下:

Galleria.loadTheme('/assets/galleria.classic.min.js'); 
    Galleria.configure({ 
     debug: false, 
     // imageCrop: true, 
     dummy: '/assets/fallback/large_default.png', 
     transition: 'fade' 
    }); 

當你想真正火起來然後改變你的清單以

// application.js 
//= require galleria.min 
//= require galleria.classic.min 
//= require galleria_setup 

然後:

if ($("#galleria").length == 1) { 
    Galleria.run('#galleria'); 
}