Example #1
0
<?php

$base_dir = dirname(__FILE__);
require $base_dir . '/../vendor/.composer/autoload.php';
use Assetix\Assetix;
// Instantiate Assetix
$assetix = new Assetix(require "config/assetix.php");
// Clear cache and production assets for testing purposes. Do not do this unless you wish
// to force recompilation even when an asset has not been changed.
$assetix->clear_cache();
$assetix->clear_production();
// Add css files to group base_css
$delay = microtime(true);
$css = array('/css/test.css');
$assetix->css('base_css', $css);
$assetix->css('ie_base_css', $css);
$delay = round(microtime(true) - $delay, 4) . " seconds";
echo "CSS delay:\t{$delay}\n";
// Add less files to group base_less
$delay = microtime(true);
$less = array('/less/test.less');
$assetix->less('base_less', $less);
$assetix->less('ie_base_less', $less);
$delay = round(microtime(true) - $delay, 4) . " seconds";
echo "LESS delay:\t{$delay}\n";
// Add styl files to group base_styl
$delay = microtime(true);
$styl = array('/styl/test.styl');
$assetix->styl('base_styl', $styl);
$assetix->styl('ie_base_styl', $styl);
$delay = round(microtime(true) - $delay, 4) . " seconds";
Example #2
0
<?php

// Example shows how to use the css rewrite filter
$base_dir = dirname(__FILE__);
require $base_dir . '/../vendor/.composer/autoload.php';
use Assetix\Assetix;
// Instantiate Assetix
$assetix = new Assetix(require "config/assetix.php");
// Clear cache and production assets for testing purposes. Do not do this unless you wish
// to force recompilation even when an asset has not been changed.
$assetix->clear_cache();
$assetix->clear_production();
$test1 = $assetix->css('ie_base_css', array('/rewrite_css/test.1.css'), true);
$assetix->set_rewrite('\\1/foo/');
$test2 = $assetix->css('ie_base_css', array('/rewrite_css/test.2.css'), true);
$assetix->set_rewrite('\\1/bar/');
$test3 = $assetix->css('ie_base_css', array('/rewrite_css/test.3.css'), true);
echo "### TEST 1 ###\n{$test1}\n";
echo "### TEST 2 ###\n{$test2}\n";
echo "### TEST 3 ###\n{$test3}\n";