-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
could u please add some sample #2
Comments
If it's pug example code you are looking for then just check out here. |
I think the kinds of examples that would be helpful here are how to use blade directives in the pug syntax. from what I can tell, you'll want to use the :escaped filter and you'll need to handle both the beginning and ending statements for each directive. eg.
It would be nice if this had some custom keyword support for them
|
Yeah I suppose I agree... It's not a very elegant solution because I feel like it messes some of the blade stuff up and doesn't work as well as I would like it to. The lack of docs isn't very helpful either. ಠ_ಠ |
I'm not a blade user myself. If there is something you learned that wasn't immediately obvious, feel free to PR the README with it. |
I noticed you closed this on grounds of the PR to README, but could the addKeyword functionality be added? Or does anyone know how to use the customKeywords passthrough for this? I have tried inputting the arguments of the above command in the passthrough array and with slight variations to no avail. Also noticed, I can't use a php function inside a tag/value (notable, the csrf_token function). I have managed to escape the inline value by doing this, Note for others: Using the {{ csrf_field() }} works. |
You can also use the raw code with:
If the functions are not global, you will have to pass it from your framework to view variables, see the helpers documentation: https://github.com/pug-php/pug#php-helpers-functions |
Just want to add some of my experience with PUG and Blade: However, I found another nice way to use PUG with Laravel: VueJs and VueLoader. It is described here: https://vuejs.org/v2/guide/single-file-components.html I just leave it here as an alternative. |
Vue.js is a really different approach. For example, to inject data in template since, you send data and template and let the client compile it. With pug server-side, you send to the client rendered HTML with data already compiled in it. But what I really not undrestand is what mix blade an pug? It seems redundant to me ( |
Yes, the approach is different. Regarding the mix of blade and pug: I thought you are bound to use Blade for things like iterations and did not looked carefully to the pug documentation. Thanks for pointing it out. |
Blade iterations are very verbose. And Pug iterations indent is meaningful. I recommend: each item in items
p=item over any blade wrapping for iterations. Also prefer to well learn and use 1 template engine rather than use several and miss nice features. |
Just starting off I am using pug to simply have the HTML look clean while using blade for the logic. |
Also the reason I was asking about custom keywords is so I can use the blade logic without :escaped |
What do you call blade logic? Sections is block in pug, component is mixin, can you tell me what feature of blade you would implement as a new keyword? Because both blade and pug are very complete template engines and I don't see what would miss. Are you looking for the |
Foreach for example. |
As I already say here: #2 (comment) and here: #2 (comment) foreach exists in pug: We should not implement blade helpers until having a good reason to do it. |
My apologies, I thought the foreach in pug would only be using JS variables, I did not realize it is integrated that nicely with Laravel's PHP. |
Glad it works for you now. :) |
See block and append. Should acheive the same goal. |
Thanks, one more question: I have this code
According to this comment the usual moustache syntax should work, but it does not. I got
in the FE. I also tried |
You don't need to use moustaches. `html(lang=config('locale')) |
could u please add some sample at
README.md
?The text was updated successfully, but these errors were encountered: