PHP code example of silbinarywolf / silverstripe-stampycss
1. Go to this page and download the library: Download silbinarywolf/silverstripe-stampycss library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
silbinarywolf / silverstripe-stampycss example snippets
Requirements::set_backend(new Stampy\Requirements_Backend());
class CSSCrushExtension extends \Extension {
public function onInit() {
csscrush_add_function('px2vw', array($this, 'px2vw'));
csscrush_add_function('px2vh', array($this, 'px2vh'));
}
public function px2vw(array $arguments, $context) {
if (!isset($arguments[1])) {
throw InvalidArgumentException(__FUNCTION__.' [0];
$screenDimen = (int)$arguments[1];
$result = ($dimen / $screenDimen) * 100;
return $result.'vh';
}
}