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

metalsmith.use/ match enhancement #406

Open
webketje opened this issue May 8, 2024 · 0 comments
Open

metalsmith.use/ match enhancement #406

webketje opened this issue May 8, 2024 · 0 comments

Comments

@webketje
Copy link
Member

webketje commented May 8, 2024

When a Metalsmith instance is intantiated, it can have a property indicating its pristine state.
When run is first called it is assigned a different value.
This property can be used to determine whether a function call happened during instantiation or during the first run.
Then the match method could be used as a built-in to replace the pattern option in many plugins.

metalsmith.use(drafts()) // match all
metalsmith.match('**/*.html').use(minifyHtml) // match html only for following plugins

Equally if not more appealing, and very similar to express js routers:

metalsmith.use('**/*.html', minfiyHtml)

though this has implications for the metalsmith.json CLI format in how array parameters vs function arguments are interpreted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant