Mixing Blade and Twig templates in Laravel - laravel

I have a Laravel 5.5 project that contains a lot of views in Twig format. In order to support Twig, the project uses the rcrowe/twigbridge package.
This works, but it’s now the only project that I have which uses Twig. Everything else is on Blade. I would like to move this project on to Blade templating, too.
However, I can’t commit a lot of time to this project and do the entire Twig to Blade transition in one go (unless there’s an automatic translator that I should know about?). Therefore it would be helpful to be able to render both Blade and Twig within the same project, at least until the transition is complete. How can I do this?

Related

Vue.js HTML template compile-time checking

We're in a process of migrating an existing ASP.NET Core Knockout.js / JS application to Vue.js / Typescript.
While the JS side gains the type-safety by the TS migration, we're having a hard time finding something that would do this checking for the HTML templates with vue bindings.
My idea (dream) would be something similar to what Razor does with it's typed models when having the precompile views option selected (when something's wrong with the bindings, it fails the build raising an error)
Is there any VS plugin, command line tool, or anything else that could provide this compile-time checking for Vue.js HTML templates?
EDIT:
To clarify better, let's say the template is
<div id="root"><div v-html="myProp"></div></div>
And very simplified Vue is like this
new Vue({el: '#root', data: { myProp: 'my neat property value' }})
Now let's say someone makes a typo in the model property name so it's for example like this
<div id="root"><div v-html="myPrapNotExisting"></div></div>
If I did something similar in Razor, it would complain once the views are compiled and it would stop the build, however I haven't found anything similar for Vue (or knockout either)
So question is, is there a clientside MVVM framework, where templates could be compile-checked?

Learning Laravel blade standalone

I'm pretty new with blade template building in Laravel and I'm planning to use it as standalone. What's the best way to learn blade template building perhaps for standalone?
What's the different components of blade template building and what's the data flow?
If you want to use without Laravel, then you could try my library.
https://github.com/EFTEC/BladeOne
Its stand alone, only one class and no dependencies (and mit license)
The docs about blade is here
https://laravel.com/docs/5.5/blade
The data flow is simple:
add all the libraries and dependencies.
creates all the
variables, collects information from $_POST,$_GET and such.
Load
and do all the operations, such as loading from the database,
inserting, doing some operation.
And finally, call the template and send the variables. The template must be called at the end of your script. Always.

Combine Backend and Frontend Development with Laravel, Patternlab, Atomic Design and Vue.js

I'm going to launch a new project with this two frameworks (I like):
Laravel 5
Vue.js
The Frontend developer prepares the HTML's in atomic design, generated with patternlab.io.
Now I'm looking how I can integrate the patternlab.io project that I don't have to rewrite all the elements in a blade template.
I found some implementations combining Patternlab & Laravel using TwigBridge, Laratash Laravel extensions.
But I've some thoughts:
In the blade templates there is: logic, conditions, loops,.... If I combine patternlab and laravel then I need to put all this in the patternlab project.
Because of using vue.js I need to add also these tags to the patternlab templates
So I think it's not the best choice to integrate the patternlab.io templates in the laravel project.
My idea was:
Frontend DEV uses patternlab to create the templates
Laravel automatically generates & imports the CSS Stylesheet generated in patternlab
The Backend Developers copy the patternlab - molecules manually in the blade templates and add their own logic
If the Frontend DEV make changes on CSS, it's fine - we'll run in no issues; after rerunning the laravel gulp process to update the css files we have the new updates.
If the Frontend DEV makes some changes on a html structure we need to manually adjust them.
Is there a better solution combining Atomic Design, Vuejs and Laravel? How do you deploy atomic design in your CMS?
In the last three Vue/Laravel projects we've created we'v stopped using PHP as a rendering engine all together and used Vue exclusively. Laravel is still a really great framework for writing business logic and apis in a clean testable way – but we've decided to never use blade again.
Typically the issue you run into when trying to create a JS rendered application with a PHP backend is the lack of server side rendering. To solve this problem I've turned to a new project out of the Vue community, Nuxt.js (I have no affiliation with them, just a happy developer). Nuxt lets you write vue components and have them be both server side rendered, and rendered in the browser after the initial page load.
This allows us to completely decouple all of the rendering responsibilities away from Laravel and keep it in a single location, so no need to do blade and Vue – it's all Vue.
The only downside is that you'll need 2 servers Node.js and PHP.

Are there any disadvantages to not using blade and having the front totally decoupled from the back end in Laravel?

I was at an interview yesterday and the interviewer asked me a few questions about blade and I replied saying that I don't use blade and only use Laravel to build RESTful web services which I then consume using a front end technology such as Angular.
He insisted that blade was very useful and there a few disadvantages to not using blade. I couldn't understand what he was talking about. And neither do I clearly remember any points he made.
I am curious to know are there any disadvantages to not using blade in Laravel?
In my opinion there are a few advantages of AngularJS over blade and vice versa:
Advantages blade:
Laravel has some html helpers and form helpers.
Laravel adds a token to a form for preventing csrf!
When you open a form you can give a route to it. The method and the action are defined by blade based on the given route.
With blade you can create macro's and view composers.
When validating a form you can return back with the input and the errors which is quite easy.
Blade is not realy slow because laravel cache the compiled views.
With blade you can extend and include views which is more DRY(Don't Repeat Yourself)
On paginator objects you can call ->links() which is very easy for pagination although this is also nice to do with AngularJS.
Blade can automatically escape you're data with {{{$var}}}.
If you've to write a multi language application blade and laravel comes with easy methods to do achieve this.
This are in my opinion the advantages of blade. Look at the blade docs for more information and figure out what you like!

Codeigniter: How can I use codeigniter's default view system along with smarty templates

I don't want to remove smarty templates from controllers. In some actions of controllers, I want to use default view system of codeigniter, while on other actions, I want to keep SMARTY templates as display medium. How can I achieve this?
Thanks in advance
I've been developing a CI Smarty library for Codeigniter. It lets you use default Codeigniter views and lets you render Smarty templates using the Codeigniter template parser as I am extending it.
Here is the repository: https://github.com/Vheissu/Ci-Smarty
As it stands, it works really well. If you have any problems, log an issue on Github and I'll fix it usually within 24 hours. Other solutions are mostly outdated, my library lets you use new Smarty 3 features like template inheritance, etc.
Look in the CodeIgniter Wiki - http://codeigniter.com/wiki/Smarty/
And a thread in the official forum:
http://ellislab.com/forums/viewthread/60050/

Resources