rmrevin/yii2-minify-view

No such file in css

Closed this issue · 6 comments

Hello, I have a problem with CSS import.
When I have import like this:

@import url("animate.min.css");
it cause exception:

file_get_contents(/css/alpha.css): failed to open stream: No such file or director

Hey. By mistake, it happens with other imports. Show is the place where connects alpha.css

I think problem can be fixed by adding base path to file path.
E.g. in file CSS.php line 218
change to
$result = file_get_contents(\Yii::getAlias($this->view->base_path . $url));

I try, it works for me, but I'm not sure that it will be better solution.

It looks fine. It is necessary to add a check that there is no url external resource, and local file and write a test for this case. I'll be glad to to accept pull request.

PR is not a problem, but I don't know how to test this case.

The extension has unit tests. We need to add a test that checks for import from an external url and local file. Nothing difficult.

Merged. Thanks.