You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently all metalsmith options can be set in a CLI format slightly different from using dedicated API methods like ignore() and destination(). Those are distinct in that calling metalsmith.destination('different/path') from within a plugin will actually alter the destination path for all files, as metalsmith.destination() is retrieved inside each metalsmith.writeFile call, whereas metalsmith.ignore() has no impact on ignored files when run from inside a plugin (though it may affect plugins relying on the output of metalsmith.ignore() and thus have unexpected results).
But there may be some uses where this is useful, so it must first be assessed whether it is possible to reproduce a build with a new instance of metalsmith without losing access to necessary info. In that regard I think it may be useful to add a metalsmith.entries(fileObj) method to programmatically set the ms entries. But in general I think the expectation from users is that a single Metalsmith build should be immutable, so a plugin cannot alter the user-defined source property.
Related to #280, consider migrating some 'methods-as-options' like source, destination, ignore, clean, frontmatter, concurrency to a separate options or config method:
metalsmith.options({source: 'src',destination: 'build',frontmatter: true,// methods like these would remain because they have other uses// like checking whether the watcher is enabled, but options method would allow setting default values for themwatch: {},metadata: {},env: {}})
The text was updated successfully, but these errors were encountered:
Currently all metalsmith options can be set in a CLI format slightly different from using dedicated API methods like
ignore()
anddestination()
. Those are distinct in that callingmetalsmith.destination('different/path')
from within a plugin will actually alter the destination path for all files, asmetalsmith.destination()
is retrieved inside eachmetalsmith.writeFile
call, whereasmetalsmith.ignore()
has no impact on ignored files when run from inside a plugin (though it may affect plugins relying on the output of metalsmith.ignore() and thus have unexpected results).But there may be some uses where this is useful, so it must first be assessed whether it is possible to reproduce a build with a new instance of metalsmith without losing access to necessary info. In that regard I think it may be useful to add a
metalsmith.entries(fileObj)
method to programmatically set the ms entries. But in general I think the expectation from users is that a single Metalsmith build should be immutable, so a plugin cannot alter the user-defined source property.Related to #280, consider migrating some 'methods-as-options' like
source
,destination
,ignore
,clean
,frontmatter
,concurrency
to a separateoptions
orconfig
method:The text was updated successfully, but these errors were encountered: