-
Notifications
You must be signed in to change notification settings - Fork 18
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
How to use this client side? #12
Comments
Decided to just compile the templates instead of injecting them into html. First I tried to use laravel-elixir-handlebars from npm, but that one adds require() in compiled templates.js file, which doesn't fit my needs, also last update was a year ago and has PR's that the owner hasn't bothered to look at. Soo I made one that works for me. If anyone is interested then you can check out at https://github.com/Swanty/laravel-elixir-handlebars |
I also had a bit of an issue using - or more likely, understanding - raw. I expected the template to be pulled as is with minimal processing, but when tracing the code I saw it was still being compiled, but in raw mode (though I'm not sure exactly how that differs or how it would be used). In the end, since I didn't have any dependencies on blade, lang, etc in my template, I ended up using a direct php include:
|
You seem to be correct, raw output is currently broken. I'd be happy to review pull requests, because It may take some time until I'll get around to fix it. We are using webpack in our pipeline, which is taking care of shipping templates to the front-end, which is why I may not have noticed this problem before. Also, maybe @markusjwetzel can take a look into it? |
Sorry, don't have time to look into this issue, so help is wanted. I added a hint to the raw output section of the readme file, so hopefully someone will read it in the readme or here and is able to help. :) |
This is how I do it, using basic webpack configuration: https://medium.com/@greut/sharing-templates-between-php-and-javascript-in-laravel-a5e07b43be24 |
Great article! I added a link to your article in the readme file. 👍 |
@greut @markusjwetzel This approach does not work with the helper function |
I'm using laravel 5.2 and raw output doesn't work for me
File: resources/views/test/sample.hbs
File: resources/views/template/default.blade.php
Output:
Basically {{title}} and {{body}} is gone, so I can't use the template in javascript.
I'm using the default config file and laravel-handlebars version 1.1.0
The text was updated successfully, but these errors were encountered: