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

Command to convert to phtml #101

Open
jeffbdavenport opened this issue Feb 7, 2017 · 5 comments
Open

Command to convert to phtml #101

jeffbdavenport opened this issue Feb 7, 2017 · 5 comments

Comments

@jeffbdavenport
Copy link

jeffbdavenport commented Feb 7, 2017

This program looks quite awesome, however it's unrealistic to include the entire MtHaml API into a custom PHP module for an existing platform, it would be awesome if I could convert my MtHaml files into phtml files. Like the coffeescript command coffee -c $file would do.

@Boorj
Copy link

Boorj commented Feb 10, 2017

Do you want to use mthaml inside nodejs stack (coffee ... command uses node.js) ? What is the purpose?
MThaml compiler is made on PHP (as twig is), so you will need php.exe anyway. Perhaps, until you rewrite all lexers, parsers and other parts on javascript to be used inside nodejs stack. Correct me, if I'm wrong.
There are several implementations of twig compiler for js, but twig is much more popular than mthaml is. So if it helps - you can convert mthaml-> twig by php, and twig->html by javascript (node).

You still can compile *.haml files with php your_script_that_generates_html.php > result.html

@jeffbdavenport
Copy link
Author

For instance in Magento 2 the template files are written in plain php / html code in a .phtml file. But I don't want to just include the entire MtHtml code into the Magento 2 module because that is just unnecessary overhead. I was hoping to have something that I could write and manage the php / html code in a slim format, and the export the files into .phtml files. I can't just convert it to plain html and put that into the module that would break the module and make it unusable.

@Boorj
Copy link

Boorj commented Feb 11, 2017

i think mthaml could be converted to php+html, why doesn't it fit your goals?

@jeffbdavenport
Copy link
Author

Does it actually output the php+html? Or is it just saying that it interprets it that way? In other words can I write a short script with mthtml to save the php+html output to another file?

@Boorj
Copy link

Boorj commented Feb 23, 2017

Even if you try to look into php cache of your framework (symfony, for example), you'll see that mthaml files are rendered to php. So yes, if you go to this section, you'll see that the 1st example shows you how to render haml to php file.

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