Pipe\Manifest::compile PHP Method

compile() public method

#
public compile ( $assets )
    function compile($assets)
    {
        $env = $this->environment;
        if (!is_dir($this->directory)) {
            mkdir($this->directory, 0700, true);
        }
        $assets = array_filter(array_map(function ($path) use($env) {
            return $env->find($path, array('bundled' => true));
        }, (array) $assets));
        foreach ($assets as $asset) {
            $this->getLogger()->info("Compiling \"{$asset->getLogicalPath()}\"");
            $start = microtime(true);
            $this->files->{$asset->getDigestName()} = array('logical_path' => $asset->getLogicalPath(), 'mtime' => date(DATE_ISO8601, $asset->getLastModified()), 'size' => strlen($asset->getBody()), 'digest' => $asset->getDigest(), 'content_type' => $asset->getContentType());
            $this->assets->{$asset->getLogicalPath()} = $asset->getDigestName();
            $asset->write(array('dir' => $this->directory, 'compress' => false, 'include_digest' => true));
            if ($this->compress) {
                $asset->write(array("dir" => $this->directory, "compress" => true, "include_digest" => true));
            }
            $this->getLogger()->info(sprintf('Finished compiling "%s" in %f seconds', $asset->getLogicalPath(), microtime(true) - $start));
            $this->save();
        }
    }

Usage Example

Exemplo n.º 1
0
 function precompile()
 {
     $dir = $this->app['pipe.precompile_directory'];
     $manifest = new Manifest($this->app['pipe.environment'], $this->app['pipe.manifest'], $dir);
     $manifest->compress = true;
     $manifest->compile((array) $this->app['pipe.precompile']);
 }
All Usage Examples Of Pipe\Manifest::compile