A
A
Alexander Ivanov2017-03-04 02:56:52
Phalcon
Alexander Ivanov, 2017-03-04 02:56:52

How to create your own FilterInterface on phalcon?

docs.phalconphp.ru/ru/latest/reference/assets.html#id7
There is an example in the article, let's say I want to test it, where should I connect it?

<?php

use Phalcon\Assets\FilterInterface;

/**
 * Filters CSS content using YUI
 *
 * @param string $contents
 * @return string
 */
class CssYUICompressor implements FilterInterface
{
    protected $_options;
.....

Should it be in the index file (bootstrap)?
// Get some CSS collection
$css = $this->assets->get("head");

// Add/Enable the YUI compressor filter in the collection
$css->addFilter(
    new CssYUICompressor(
        [
            "java-bin"      => "/usr/local/bin/java",
            "yui"           => "/some/path/yuicompressor-x.y.z.jar",
            "extra-options" => "--charset utf8",
        ]
    )
);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question