grunt-polymer-wp
Version:
A new Grunt pipeline for Wordpress themes in HTML/js/css and Polymer webcomponents developing
81 lines (72 loc) • 2.92 kB
JavaScript
(function() {
'use strict';
//var nomeTema = '@@url';
// Localstorage Check
function skipCache(){
var test = 'test';
try {
localStorage.setItem(test,test);
localStorage.removeItem(test);
return false;
} catch(e) {
return true;
}
}
if(skipCache() == false){
console.log('skipCache = false');
} else {
console.log('skipCache = true');
}
// Localstorage webFonts Check
// var font_href = 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:900italic,900,700italic,700,600italic,400italic,600,400,300italic,300,200italic,200';
// if(skipCache() == false && localStorage.webFonts){
// injectRawFontsStyle(localStorage.getItem('webFonts'));
// } else {
// window.onload = function(){
// injectFontsStyle();
// }
// }
// function injectFontsStyle(){
// console.log('injectFontsStyle');
// var xhr = new XMLHttpRequest();
// xhr.open('GET', font_href, true);
// xhr.onreadystatechange = function(){
// if (xhr.readyState === 4){
// injectRawFontsStyle(xhr.responseText);
// localStorage.setItem('webFonts', xhr.responseText);
// }
// }
// xhr.send();
// }
// function injectRawFontsStyle(text){
// console.log('injectRawFontsStyle');
// var style = document.createElement('style');
// style.innerHTML = text;
// document.getElementsByTagName('head')[0].appendChild(style);
// }
// BasketJs
var version = '@@version';
function requireScriptsMain() {
return basket.require(
{url: '@@urljs/main.js', key:'mainJS', unique: '@@version', skipCache:true}
)
};
function requireScriptsDelay2() {
return basket.require(
{url: '@@urljs/libs/jquery-ui.min.js', key:'jqueryUI', unique: '@@version', skipCache: skipCache()},
{url: '@@urljs/libs/modernizr-2.8.3.min.js', key:'modernizr', unique: '@@version', skipCache: skipCache()},
{url: '@@urljs/libs/owl.js', key:'owl', unique: '@@version', skipCache: skipCache()},
{url: '@@urljs/libs/stickykit.js', key:'sticky', unique: '@@version', skipCache: skipCache()},
{url: '@@urljs/libs/materialize.min.js', key:'materialize', unique: '@@version', skipCache: skipCache()}
).then(requireScriptsMain);
};
//
// function requireScriptsDelay() {
// return basket.require(
// {url: '@@urljs/libs/AnimOnScroll.js', key:'animonscroll', unique: version, skipCache: skipCache()}
// ).then(requireScriptsDelay2);
// }
basket.require(
{url: '@@urljs/libs/jquery-2.2.1.min.js', key:'jquery', unique: '@@version', skipCache: skipCache()}
).then(requireScriptsDelay2);
}());