Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith Loy committed Mar 21, 2012
2 parents 7eee457 + 2f6931e commit c07337f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 34 deletions.
48 changes: 19 additions & 29 deletions src/Assetix/Compiler.php
Expand Up @@ -78,14 +78,8 @@ public function css($group = '', $files = array(), $is_ie = false)
$assets = array('@'.$group);
$filters = array();
$filters[] = 'less';
if ($is_ie === true or $this->_is_debug() === true)
{
$filters[] = 'css_rewrite';
}
else
{
$filters[] = 'css_embed';
}
$is_ie === false and $filters[] = '?css_embed';
$filters[] = 'css_rewrite';

return $this->_render($assets, $filters);
}
Expand All @@ -98,14 +92,8 @@ public function less($group = '', $files = array(), $is_ie = false)
$assets = array('@'.$group);
$filters = array();
$filters[] = 'less';
if ($is_ie === true or $this->_is_debug() === true)
{
$filters[] = 'css_rewrite';
}
else
{
$filters[] = 'css_embed';
}
$is_ie === false and $filters[] = '?css_embed';
$filters[] = 'css_rewrite';

return $this->_render($assets, $filters);
}
Expand All @@ -118,14 +106,8 @@ public function styl($group = '', $files = array(), $is_ie = false)
$assets = array('@'.$group);
$filters = array();
$filters[] = 'styl';
if ($is_ie === true or $this->_is_debug() === true)
{
$filters[] = 'css_rewrite';
}
else
{
$filters[] = 'css_embed';
}
$is_ie === false and $filters[] = '?css_embed';
$filters[] = 'css_rewrite';

return $this->_render($assets, $filters);
}
Expand Down Expand Up @@ -295,16 +277,16 @@ protected function _get_fm()
protected function _setup_filters()
{
$config = $this->_get_config();
$this->_add_filter('yui_js', new Yui\JsCompressorFilter($config['yuicompressor_path']));

// 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('css_rewrite', new MyCssRewriteFilter(
$config['css_rewrite_replacement'], $config['css_rewrite_pattern']));
$this->_add_filter('less', $less);
$this->_add_filter('styl', $styl);
$css_embed = new CssEmbedFilter($config['cssembed_path']);
Expand All @@ -315,11 +297,19 @@ protected function _setup_filters()
$css_embed->setMhtml(false);
$css_embed->setCharset('utf8');
$this->_add_filter('css_embed', $css_embed);
$this->_add_filter('underscore', new UnderscoreFilter(
$config['underscore_namespace']), $config['underscore_ext']);
$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']);
}
}
8 changes: 3 additions & 5 deletions src/Assetix/Filter/MyCssRewriteFilter.php
Expand Up @@ -41,7 +41,9 @@ public function __construct($replacement = '\\1/assets/production/', $pattern =
$this->pattern = $pattern;
}

public function filterLoad(AssetInterface $asset)
public function filterLoad(AssetInterface $asset){}

public function filterDump(AssetInterface $asset)
{
$replacement = $this->getReplacement();
$pattern = $this->getPattern();
Expand All @@ -51,10 +53,6 @@ public function filterLoad(AssetInterface $asset)
$asset->setContent($content);
}

public function filterDump(AssetInterface $asset)
{
}

public function setReplacement($replacement)
{
$this->replacement = $replacement;
Expand Down

0 comments on commit c07337f

Please sign in to comment.