kalamuna / metalsmith-jstransformer

Metalsmith JSTransformers Plugin
http://npm.im/metalsmith-jstransformer
MIT License
7 stars 9 forks source link

Extend plugin with possibility to process one transformation per use #18

Closed ycherniavskyi closed 7 years ago

ycherniavskyi commented 7 years ago

Current implementation of metalsmith-jstransformer plugin process all necessary transformation from extensions and apply layout (if passed) at the end in one run.

But what if I need apply only one transformation on first use. Then execute some other plugins. And finally apply all remained transformation with layout. Example use case:

  1. apply only Markdown transformation on some-blog-post.html.md
  2. execute for example metalsmith-word-count plugin
  3. apply layout with some-blog-post.html content and word count data calculated by previous plugin

May be someone could suggest some already existed solution for this use case.

ycherniavskyi commented 7 years ago

I have tried to call metalsmith-jstransformer plugin two times (first with specified pattern for blog posts and with empty layoutPattern, and second with general pattern and layoutPattern), but it does not work as I understand because of jstransformerDone property assigned to file after first plugin execution.

RobLoach commented 7 years ago

Per use? Change the process in which jstransformers are taken place?

Have word-count process on content before it's passed into the layouts? Seems like you'd want work-count to process before jstransformers.

ycherniavskyi commented 7 years ago

Sorry for intricate terminology - by use I mean Metalsmith API .use(plugin) method.

From my review all plugins which get some information about/from text stick with HTML format (metalsmith-word-count, metalsmith-better-excerpts etc), so they couldn't be applied to Markdown.