<commit_before><?php namespace Codesleeve\AssetPipeline\Filters;

use Assetic\Asset\AssetInterface;
use Assetic\Filter\FilterInterface;
use CoffeeScript\Compiler;

class CoffeeScript implements FilterInterface
{
    public function __construct()
    {

    }

    public function filterLoad(AssetInterface $asset)
    {

    }

    public function filterDump(AssetInterface $asset)
    {
        $content = $asset->getContent();

		$content = Compiler::compile($content, array('filename' => $asset->getSourcePath()));

        $asset->setContent($content);<commit_msg>CoffeeScript filter custom config<commit_after><?php namespace Codesleeve\AssetPipeline\Filters;

use Assetic\Asset\AssetInterface;
use Assetic\Filter\FilterInterface;
use CoffeeScript\Compiler;

class CoffeeScript implements FilterInterface
{
    var $config = array();
    public function __construct($config=null)
    {
	if($config)
	{
		$this->config = $config;
	}
    }

    public function filterLoad(AssetInterface $asset)
    {

    }

    public function filterDump(AssetInterface $asset)
    {
        $content = $asset->getContent();
        
        $config = array_merge(array('filename' => $asset->getSourcePath()), $this->config);

		$content = Compiler::compile($content, $config);

        $asset->setContent($content);
{'fraction_non_alphanumeric': 0.12116564417177914, 'fraction_numerical': 0.0, 'mean_word_length': 4.038610038610039, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7316309', 'n_tokens_mistral': 378, 'n_tokens_neox': 362, 'n_words': 73}