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

[META] Twig integration #15

Open
mrjmd opened this issue Apr 8, 2016 · 5 comments
Open

[META] Twig integration #15

mrjmd opened this issue Apr 8, 2016 · 5 comments

Comments

@mrjmd
Copy link
Owner

mrjmd commented Apr 8, 2016

Twig templates are the Drupal standard. We should definitely support twig-based components out of the box, but there are several possible ways this could be integrated.

Does it need its own framework-defining sub module, or should it be included by default? What about other frameworks that may want to build on top of twig templates (ng2-twig integration is happening but the details remain murky at this point)?

@mrjmd
Copy link
Owner Author

mrjmd commented Apr 26, 2016

Capturing some of my discovery work here:

https://github.com/twigjs/twig.js <-- likely to be relevant to any twig communication with the client side. Also this twig.js library appears to be used in the existing integration of Angular 2 and Twig templates, which can be found here:

https://github.com/acquia/js-exploration/tree/angular2-twig-exploration

We'll need to either do more digging or reach out directly to those involved in the JS Exploration work to get full details on that integration.

@mrjmd
Copy link
Owner Author

mrjmd commented May 27, 2016

I did get more details about the existing twig / ng2 template integration and, as I've written about elsewhere, while interesting it is not an ideal solution.

Instead I propose that initial twig integration should be put directly into the main pdb module, and involve the ability to add twig template files to a component's info.yml file. These files by default should be rendered server side by Drupal as any other twig template would be.

@kenneth-bolivar-castro
Copy link
Contributor

@mrjmd don't get my wrong, but I cannot see why we should create integration with twig to be render for Drupal since the main idea here it's to build a decoupled solution for JS frameworks

@ghost
Copy link

ghost commented May 27, 2016

@kenneth-bolivar-castro As far as I'm aware, this wouldn't be Drupal-specific Twig. It would be generic Twig, which fits well with other uses of JS components as part of apps that use twig, such as mobile apps or even node.js apps.

I would like to think at some point that you could make a stand-alone component with JS, Twig, etc. that could be used in any of those apps, including Drupal.

@mrjmd
Copy link
Owner Author

mrjmd commented May 27, 2016

My two cents: The idea is that, at its root, the main pdb module is essentially a "component API". A decoupled block is a component written in its own directory with a corresponding info.yml file that declares its existence to Drupal, and lists whatever js, css, and template assets are needed to make it work.

For the most part, people will likely be building components that leverage a specific javascript framework, but there are use cases for simply componentizing css and template files. Essentially this would be a way to write a custom block module without writing any of the scaffolding code, you'd just write your component, add your info.yml file, and place your block.

The level of effort here should be low, but I'm open to whether this should go in the main pdb module or be another sub-module.

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