/** * @group integration */ public function testFilterLoadWithCompression() { if (!isset($_SERVER['NODE_BIN']) || !isset($_SERVER['NODE_PATH'])) { $this->markTestSkipped('No node.js configuration.'); } $asset = new StringAsset("body\n font 12px Helvetica, Arial, sans-serif\n color black;"); $asset->load(); $filter = new StylusFilter(__DIR__, $_SERVER['NODE_BIN'], array($_SERVER['NODE_PATH'])); $filter->setCompress(true); $filter->filterLoad($asset); $this->assertEquals("body{font:12px Helvetica,Arial,sans-serif;color:#000}\n", $asset->getContent(), '->filterLoad() parses the content and compress it'); }
protected function _setup_filters() { $config = $this->_get_config(); // Stylesheet filters $less = new LessFilter($config['node_path'], $config['node_paths']); $styl = new StylusFilter($config['node_path'], $config['node_paths']); // Enable compression if ($this->_is_debug() === false) { $less->setCompress(true); $styl->setCompress(true); } $this->_add_filter('less', $less); $this->_add_filter('styl', $styl); $css_embed = new CssEmbedFilter($config['cssembed_path']); if ($config['cssembed_root'] !== false) { $css_embed->setRoot($config['cssembed_root']); } $css_embed->setMhtml(false); $css_embed->setCharset('utf8'); $this->_add_filter('css_embed', $css_embed); $css_rewrite = new MyCssRewriteFilter($config['css_rewrite_replacement'], $config['css_rewrite_pattern']); $this->_add_filter('css_rewrite', $css_rewrite); // Javascript filters $this->_add_filter('yui_js', new Yui\JsCompressorFilter($config['yuicompressor_path'])); $this->_add_filter('coffee', new CoffeeScriptFilter($config['coffee_path'], $config['node_path'])); // Javascript template filters $this->_add_filter('handlebars', new HandlebarsFilter($config['handlebars_path'], $config['node_path'])); $this->_add_filter('underscore', new UnderscoreFilter($config['underscore_namespace']), $config['underscore_ext']); }