Created
February 10, 2017 17:39
-
-
Save zooks/f169b361257bb226967a8d4e6110b360 to your computer and use it in GitHub Desktop.
inline CSS snippet for MODX Revolution
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
<?php | |
// [[!inline?&file=`css/critical.css`]] | |
$assetsPath = $modx->getOption('assets_path'); | |
$file = !empty($file) ? $file : $modx->getOption('file', $scriptProperties, ''); | |
$myfile = fopen($assetsPath . $file, "r"); | |
if (!$myfile){ return "";} | |
$inlneCSS = ""; | |
while(!feof($myfile)) { | |
$inlneCSS .= fgets($myfile); | |
} | |
fclose($myfile); | |
return $inlneCSS; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment