This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Генерирует webp копии изображений сразу после загрузки изображения в медиабиблиотеку | |
* | |
* - новые файлы сохраняет с именем name.ext.webp, например, thumb.jpg.webp | |
*/ | |
function gt_webp_generation($metadata) { | |
$uploads = wp_upload_dir(); // получает папку для загрузки медиафайлов | |
$file = $uploads['basedir'] . '/' . $metadata['file']; // получает исходный файл | |
$ext = wp_check_filetype($file); // получает расширение файла |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var CSSCriticalPath = function(w, d, opts) { | |
var opt = opts || {}; | |
var css = {}; | |
var pushCSS = function(r) { | |
if(!!css[r.selectorText] === false) css[r.selectorText] = {}; | |
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/); | |
for(var i = 0; i < styles.length; i++) { | |
if(!!styles[i] === false) continue; | |
var pair = styles[i].split(": "); |