Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler's method getContent() does not pass $file parameter to any filter #132

Open
MartinPavlik opened this issue Aug 26, 2016 · 0 comments

Comments

@MartinPavlik
Copy link

MartinPavlik commented Aug 26, 2016

This causes that cssUrlsFilter does not work.

I believe, the problem is here: Compiler line 168

I use following fix that works fine for me:

    /**
     * Get joined content of all files
     * @param array $files
     * @return string
     */
    public function getContent(array $files = null)
    {
        if ($files === null) {
            $files = $this->collection->getFiles();
        }
        // load content
        $result = '';
        foreach ($files as $file) {
            $fileContent = PHP_EOL . $this->loadFile($file);
            foreach($this->filters as $filter) {
                $fileContent = call_user_func($filter, $fileContent, $this, $file);
            }
            $result .= $fileContent;
        }
        return $result;
    }

I can create a pull request, but I can't pass tests due to:

1) WebLoader\Test\CompilerTest::testGeneratingAndFilters
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
 '-
-a:cba,
-b:fed,
+a:cba,-
+a:cba,-
+b:fed,-
+b:fed,-
 c:ihg,-
-a:cba,
-b:fed,
 c:ihg,'

https://forum.nette.org/cs/2578-addon-webloader-extras-webloader?p=7#p165520

@janmarek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant