Example #1
0
    public function filterLoad(AssetInterface $asset)
    {
        static $manifest = <<<EOF
name: Application%s
sources: [source.js]

EOF;
        $hash = substr(sha1(time() . rand(11111, 99999)), 0, 7);
        $package = sys_get_temp_dir() . '/assetic_packager_' . $hash;
        mkdir($package);
        file_put_contents($package . '/package.yml', sprintf($manifest, $hash));
        file_put_contents($package . '/source.js', $asset->getContent());
        $packager = new \Packager(array_merge(array($package), $this->packages));
        $content = $packager->build(array(), array(), array('Application' . $hash));
        unlink($package . '/package.yml');
        unlink($package . '/source.js');
        rmdir($package);
        $asset->setContent($content);
    }
Example #2
0
	try {
		console.log('' + message)
	}
	catch (e){}
}

var domreadyCallbacks = []
function DomReady(fn){
	domreadyCallbacks.push(fn)
}
 <?php 
if (!isset($_GET['plain'])) {
    $core = dirname(__FILE__) . '/../../../';
    require $core . 'Packager/packager.php';
    $pkg = new Packager(array($core));
    echo $pkg->build(array('DOMReady'), array(), array(), array());
} else {
    ?>
document.write('<scr'+'ipt src="./DOMReady.js?' + (new Date) + '"><'+'/script>');
document.write('<scr'+'ipt src="../../../Source/Utilities/DOMReady.js?' + (new Date) + '"><'+'/script>');
 <?php 
}
?>
</script>

<script>
var loadScript = function(type){
	var count = 0;
	new Element('script', {
		src: '../../Configuration.js?' + type + (new Date),
		events: {
Example #3
0
<?php

$config = (include 'config.php');
header('Content-Type: text/javascript');
require dirname(__FILE__) . '/Packager/packager.php';
$pkg = new Packager($config['sources']);
$components = $_GET['require'];
$files = empty($components) ? $pkg->get_all_files() : $pkg->components_to_files(explode(',', $components));
$files = $pkg->complete_files($files);
$exclude_blocks = isset($config['exclude-blocks']) ? $config['exclude-blocks'] : array();
if (isset($_GET['12compat'])) {
    foreach ($exclude_blocks as $i => $block) {
        if ($block == '1.2compat') {
            unset($exclude_blocks[$i]);
        }
    }
}
$output = $pkg->build($files, array(), array(), $exclude_blocks);
echo PHP_EOL . '// Required Files' . PHP_EOL;
foreach ($files as $file) {
    echo "// - {$file}: [" . implode(", ", $pkg->get_file_provides($file)) . "]\n";
}
echo PHP_EOL;
echo $output;