Pipe\Config::createEnvironment PHP Method

createEnvironment() public method

# Returns a new Environment instance.
public createEnvironment ( )
    function createEnvironment()
    {
        $env = new Environment();
        $loadPaths = $this->loadPaths ?: array();
        foreach ($loadPaths as $path) {
            $env->appendPath(dirname($this->filename) . "/" . $path);
        }
        if (!$this->debug) {
            if ($jsCompressor = $this->jsCompressor) {
                $env->setJsCompressor($jsCompressor);
            }
            if ($cssCompressor = $this->cssCompressor) {
                $env->setCssCompressor($cssCompressor);
            }
        }
        return $env;
    }

Usage Example

コード例 #1
0
ファイル: ConfigTest.php プロジェクト: chh/pipe
 function testCreateEnvironmentWithCompressors()
 {
     $config = new Config(array('js_compressor' => 'uglify_js', 'css_compressor' => 'yuglify_css'));
     $env = $config->createEnvironment();
     $this->assertTrue($env->bundleProcessors->isRegistered($env->contentType('.js'), $env->compressors['uglify_js']));
     $this->assertTrue($env->bundleProcessors->isRegistered($env->contentType('.css'), $env->compressors['yuglify_css']));
 }