rmrevin / yii2-minify-view

Yii2 View component with minification css & js
MIT License
191 stars 67 forks source link

No such file in css #32

Closed ZAYEC77 closed 8 years ago

ZAYEC77 commented 8 years ago

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

rmrevin commented 8 years ago

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

ZAYEC77 commented 8 years ago

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.

rmrevin commented 8 years ago

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.

ZAYEC77 commented 8 years ago

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

rmrevin commented 8 years ago

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

rmrevin commented 8 years ago

Merged. Thanks.