metalsmith / layouts

A metalsmith plugin for layouts
MIT License
116 stars 49 forks source link

Supporting async-only jstransformers; fixes #166 #167

Closed howarddierking closed 5 years ago

howarddierking commented 5 years ago

The core of this PR is to switch from calling jstransformer's renderFile function to instead calling renderFileAsync. Because of the sync fallback support in jstransformer (https://github.com/jstransformers/jstransformer/blob/69fd94c47500fe4d4c8d9f1ac2918c2a55075db0/index.js#L345), calling the async function should work for both async and sync template engines.

The only additional change in this PR is to move code unrelated to the async operations out of the scope of the promise code.

I looked for a place to add tests to verify, but all of the test fixtures in the repository were more granular than this specific change. All current tests pass, though.

howarddierking commented 5 years ago

Addresses #166

ismay commented 5 years ago

Published in 2.3.0, thanks for the PR!