DougBeney / jekyll-pug

Jekyll Plugin That Allows You To Use Pug
MIT License
37 stars 2 forks source link

Can't get pug mixins working with shipped pug versions #12

Closed nello closed 6 years ago

nello commented 6 years ago

Hi. Thanks for the project. It basically works well for me with globally-installed pug, but not at all with shipped versions.

Unfortunately I'm trying to get a CloudCannon CMS up, which precludes global installs, but the | {% include %} syntax doesn't seem to give me working mixins. Mostly I'm seeing errors like:

"Liquid Exception: TypeError: pug_mixins.bigfoot is not a function in /_layouts/default.pug"

Right now the only thing close to working is all my code in one file, which is pretty ... sub-optimal.

Any help at all would be appreciated. Thanks!

DougBeney commented 6 years ago

Thanks for using Jekyll-Pug!

The reason that you are not able to use mixins by using the Jekyll/Liquid include tag is because this plugin compiles in the following order:

Pug has no knowledge of the mixins since they have not been processed yet.

I haven't used CloudCannon before. Do they happen to allow you to run commands during the build process? You might be able to work around this by installing Pug through a command and using the system Pug compiler. That is how it works with Netlify.

DougBeney commented 6 years ago

Hi, @nello. Still having trouble?

nello commented 6 years ago

Hi, thanks for asking. I never did manage to get Jekyll includes working with pug files using shipped versions. :(

I did get a working version of the project up, but only by inlining required mixins into all the files that needed them; not really optimal (or DRY).

In the end, I've decided to go an entirely different route and use a headless CMS (like https://www.contentful.com/) rather than CloudCannon, which means I can continue to use Pug the way I was previously.

I've starred your project and will definitely keep it in mind for future sites where I have full control of the environment, but can't see shipped versions ever being useful with the current constraints.

Thanks for all your work!

Nello

On 27 Dec 2017, at 06:38, Doug Beney notifications@github.com wrote:

Hi, @nello. Still having trouble?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

DougBeney commented 6 years ago

No worries. Hope you now have a smooth workflow with Contentful.

If you don't mind me asking, what does your current setup look like to use Pug + Contentful?

nello commented 6 years ago

Hi Doug,

Our use case is probably quite different from the usual static site setup; we were looking at adding CMS functionality to an Angular app already using Pug. This meant that all the marketing pages already present, written in Pug, needed to be ported to Jekyll (plus a fair bit of Angular wrangling to retain current functionality).

I'm still spiking out a Contentful Solution, but essentially it's quite similar to the CloudCannon-powered Jekyll approach, with text/image components flowing into our responsive pages based on configuration in Contentful. The major thing we will miss is a real wysiwyg experience for the content creator, but we can give them a reasonable feel for what they'll get by providing a live dev environment that their pre-publication changes affect.

Thanks again for your project. I'll certainly keep it in mind for other applications and appreciate the work you've put into it.

Cheers, Neil

On 1 Jan 2018, at 3:04:46PM, Doug Beney notifications@github.com wrote:

No worries. Hope you now have a smooth workflow with Contentful.

If you don't mind me asking, what does your current setup look like to use Pug + Contentful?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DougBeney/jekyll-pug/issues/12#issuecomment-354635680, or mute the thread https://github.com/notifications/unsubscribe-auth/AA692hpRUHi9ReBg5hQcJQ5130GVGCkHks5tGFldgaJpZM4RGe5l.

DougBeney commented 6 years ago

Thanks for sharing! Very interesting.

No problem with creating this plugin! I was shocked nobody had already made a usable one. Had to step up to the plate because I absolutely did not like wrangling with large HTML projects. :P