2013-02-20 44 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'); 
}