undefined%
undefined%
undefined%
undefined%
undefined%
files.set('some/file.html', { contents: Buffer.from('Hello') })
files.get('some/file.html')
files.delete('some/file.html')
files.values() // get all file objects
files.keys() // get all file paths
files.entries() // get all files as [key, path]
.useV2
coexisting with .use
, which makes restructuring of data with all it's overhead only necessary if they are in direct succession:.use(...).use(...)
and .useV2(...).useV2(...)
with no overhead.use(...).useV2(...).use(...)
with two times overhead.use(...).use(...).useV2(...).useV2(...)
with one time overheaddeno run --compat --unstable --allow-read --allow-env metalsmith.js
requests
plugin:metalsmith(__dirname)
.use(
requests([
{
url: 'https://api.github.com/repos/metalsmith/:repo/contents/README.md',
out: { path: 'docs/core-plugins/metalsmith-:repo.md' },
with: [
{ repo: 'layouts' },
{ repo: 'permalinks' },
{ repo: 'remove' }
],
options: {
auth: 'metalsmith:fakeToken3EK3rZErklazr33526',
headers: {
'Accept': 'application/vnd.github.3.raw'
}
}
}
])
)
/ms-admin
). It's not for now yet, but I have the ambition to bridge the gap between expensive headless CMS & non-user-friendly static site generation.Ugh I'm really pulling my hair out about this one, feedback welcome.
So I'm hesitating how to make the debug & log features available keeping the API footprint as small as possible for 2.5.
The primary feature is ofc that a plugin can do const debug = metalsmith.debug('metalsmith-myplugin'); debug('sth'); debug.warn('warning')
.
But the tricky part is the debug log. it requires a NodeJS writestream (which needs to be ended after all plugins have run, so it cannot be implemented by a plugin).
Additionally, 2.5 will provide the convenience that env vars don't need to be specified on the command-line (eg, debug can be toggled by doing metalsmith.env('DEBUG', true)
, NB: this will also help clean up plugin readme's Debug section, as it's canonical for Windows & Linux). My concerns are:
metalsmith.env('DEBUG_LOG', true)
, 2) depending on the value of metalsmith.env('NAME') // or NODE_ENV
(log when !== 'production').I don't want to add a metalsmith.log
function as it would be confusing/ overlap with metalsmith.debug/ env
functionality