lundi 27 juin 2016

Relative Paths on precompiled assets rails asset pipeline and revolution slider


I am trying to install the Revolution Slider plugin on my Rails 4 application and I am having trouble with dynamically created relative paths in the jquery.themepunch.revolution.js file. Something is wrong with the paths, as I am getting this error in the console for each of the 9 extension files in the 'extensions' folder:

Slider Revolution 5.0 Error !
Failure at Loading:revolution.extension.navigation.min.js on Path:extensions/

I AM using asset pipeline.
my folder structure is such:

for the file where the paths are defined:

assets/javascripts/plugins/revolution/jquery.themepunch.revolution.js


for the files referenced by the paths (which are other .js files)

assets/javascripts/plugins/revolution/extensions/ *.js


This is the bit of code in 'jquery.themepunch.revolution.js' that creates the paths to the .js files in the extensions subfolder:

       extensions:"extensions/", 
       extensions_suffix:".min.js",
       debugMode:true
            };

and I believe this is the piece of js that triggers the error message:

var lAjax = function(s,o) {
    if (jQuery('body').data(s)) return false;
    if (o.filesystem) {
        if (o.errorm===undefined) 
            o.errorm = "<br>Local Filesystem Detected !<br>Put this to your header:";
        console.warn('Local Filesystem detected !');
        o.errorm = o.errorm+'<br>&lt;script type="text/javascript" src="'+o.jsFileLocation+s+o.extensions_suffix+'"&gt;&lt;/script&gt;';
        console.warn(o.jsFileLocation+s+o.extensions_suffix+' could not be loaded !');
        console.warn('Please use a local Server or work online or make sure that you load all needed Libraries manually in your Document.');
        console.log(" ");
        o.modulesfailing = true;
        return false;
    }
    jQuery.ajax({
        url:o.jsFileLocation+s+o.extensions_suffix,
        'dataType':'script',
        'cache':true,
        "error":function(e) {
            console.warn("Slider Revolution 5.0 Error !")
            console.error("Failure at Loading:"+s+o.extensions_suffix+" on Path:"+o.jsFileLocation)
            console.info(e);
        }           
    });
    jQuery('body').data(s,true);
}

I have tried writing the path these ways in the jquery.themepunch.revolution.js file:

assets/javascripts/plugins/revolution/extensions/
javascripts/plugins/revolution/extensions/
/extensions/
app/assets/javascripts/plugins/revolution/extensions/


Aucun commentaire:

Enregistrer un commentaire