Sha256: c0825d32d91cdf8c07b90677288ccf19be05a465e4efae31a22c90d8ddfa20d0

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

<?php
/* SVN FILE: $Id: HamlSassFilter.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
/**
 * {@link Sass http://sass-lang.com/} Filter for
 * {@link http://haml-lang.com/ Haml} class file.
 * @author			Chris Yates <chris.l.yates@gmail.com>
 * @copyright		Copyright (c) 2010 PBM Web Development
 * @license			http://phamlp.googlecode.com/files/license.txt
 * @package			PHamlP
 * @subpackage	Haml.filters
 */

require_once('HamlCssFilter.php');
require_once(dirname(__FILE__).'/../../sass/SassParser.php');

/**
 * {@link Sass http://sass-lang.com/} Filter for
 * {@link http://haml-lang.com/ Haml} class.
 * Parses the text as Sass then calls the CSS filter.
 * Useful for including inline Sass.
 * @package			PHamlP
 * @subpackage	Haml.filters
 */
class HamlSassFilter extends HamlBaseFilter {
	/**
	 * Run the filter
	 * @param string text to filter
	 * @return string filtered text
	 */
	public function run($text) {
		$sass = new SassParser();
		$css = new HamlCssFilter();
		$css->init();

		return $css->run($sass->toCss(preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \1; ?>', $text), false));
	}
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
frontsau-0.0.3 lib/Phamlp/haml/filters/HamlSassFilter.php
frontsau-0.0.2 lib/Phamlp/haml/filters/HamlSassFilter.php
frontsau-0.0.1 lib/Phamlp/haml/filters/HamlSassFilter.php