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

Error I get after minifying stylesheet #8

Closed
hojabbr opened this issue Apr 29, 2015 · 15 comments
Closed

Error I get after minifying stylesheet #8

hojabbr opened this issue Apr 29, 2015 · 15 comments

Comments

@hojabbr
Copy link

hojabbr commented Apr 29, 2015

FatalErrorException in efdbb806241fa94d03a450184eaa183f line 0: 
Method Illuminate\View\View::__toString() must not throw an exception
@markcameron
Copy link

Is your call to {!! Minify::stylesheet('/css/main.css') !!} inside a view that your are setting to a variable rather then outputting directly? Try outputting it directly and you'll see the real error, this could just be that one of the CSS files does not have the correct path, which throws an exception, which makes the view break.

@hojabbr
Copy link
Author

hojabbr commented Apr 29, 2015

This is in a blade file (header.blade.php):

  <link href="/themes/bootstrap/assets/frontend/layout/css/themes/blue.css" rel="stylesheet" id="style-color">

However when I turn it into:

{!! Minify::stylesheet('/themes/bootstrap/assets/frontend/layout/css/themes/blue.css') !!}

I get the mentioned error.

@hojabbr
Copy link
Author

hojabbr commented Apr 29, 2015

I should also mention the path is correct and has been tested many times before using minify.

@hojabbr
Copy link
Author

hojabbr commented Apr 29, 2015

I have also emptied the ignore environments:

    'ignore_environments' => array(
    ),

@markcameron
Copy link

What's the path to the blue.css relative to the laravel root?

@markcameron
Copy link

Can you also post the code where you are doing the return view('.....') ?

@hojabbr
Copy link
Author

hojabbr commented Apr 29, 2015

return Theme::view('frontend/index-header-fix');

@markcameron
Copy link

Not familiar with a Theme Facade, is it possible to write it as

return view('frontend/index-header-fix');

Just to test it so that it throws the real exception, rather then the exception that the view threw an exception?

@hojabbr
Copy link
Author

hojabbr commented Apr 29, 2015

Guess what you asked made me realize the problem. The theme package I'm using (caffeinated/themes) uses the public folder as it's view folder for themes, while your package is looking for them in the resources folder. So this is why the exception is being thrown. Is there a way to overwrite the "resouces" folder to "public" folder without changing the core files in your package, for example adding a parameter to the config file?

@markcameron
Copy link

Hmmm, caffeinated/themes uses the public folder for views? That shouldn't have an effect on the way the package works... As long as the CSS files are in the public folder, it should find them, no matter where the view it is called from is stored.

@hojabbr
Copy link
Author

hojabbr commented Apr 29, 2015

As you requested I used plain old "return view" and seems there is nothing wrong with the package:

<script src="/asset_builds/js/builds/d063a6361d72a3d99c6bfe3a3ebd4b781429738218.js"></script>

So the problem must be the theme package (caffeinated/themes).

@markcameron
Copy link

Hmm interesting... Wonder why it is doing that...

@markcameron
Copy link

Could be a namespace issue... tried this?

{!! \Minify::stylesheet('/themes/bootstrap/assets/frontend/layout/css/themes/blue.css') !!}

with the \ before Minify?

@hojabbr
Copy link
Author

hojabbr commented Apr 29, 2015

I found out why when I managed to make it work on a simple return view.
Because of the theme package, somehow the error shown is not correct one. While it should have been a "builds folder doesn't exist" error, for me to immediately identify that the builds folder for the assets is not where it should be (and that it doesn't have write permission) I was confused with another error. Anyway now with everything in their correct place and write permissions it's playing well with the Theme package.

Thanks for the hints and the help :)

@markcameron
Copy link

No problem, glad you got it working!

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

2 participants