pug-php / pug

Pug template engine for PHP
https://www.phug-lang.com
MIT License
387 stars 42 forks source link

Using pug-php with gulp? #219

Closed hmouhtar closed 5 years ago

hmouhtar commented 5 years ago

Hi!

I'm currently using gulp to automatically compile my .pug files on changes and convert them to .php files with gulp-rename. The only issue now is that I can't really write php expressions on the .pug files so I guess this plugin would solve that problem, now, my question is: How can I plug this with Gulp? I'm not using any PHP framework. Thanks beforehand!

kylekatarnls commented 5 years ago

Hi,

Not sure to understand. If you're not using PHP, you should not use pug-php, you should use pug-js, then it would be easy to plug to gulp/grunt/webpack and you would write expressions in JS (no PHP at all).

If you want to run it using PHP engine (so expressions are executed with PHP even if written in JS-style) and watch changes, use our watcher: https://www.phug-lang.com/#watch-changes-and-autocompile

hmouhtar commented 5 years ago

I'm currently using Wordpress and I want to simplify the templating markup by using pug. These templates are php files that run Wordpress functions that the pug compiler is unable to interpret. What I wanna achieve is to add php support to the pug compiler while still using JS(gulp) to compile. Is it possible? Sorry if I'm making this hard to understand.

kylekatarnls commented 5 years ago

Indeed, with wordpress you need pug-php.

@welaika made an adapter for wordpress, it may be far easier than using gulp to compile templates: https://github.com/welaika/wordless

The link I gave you sooner (the watcher) is still a valid solution (no matter the CMS/framework).

Gulp can run any script you wrote (in PHP or any language), so it's still possible for you to write a custom PHP script for Gulp. But is has no advantages in this situation over other solution, so we won't provide and test tools for that.

It remains theoretically possible.