Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Kevin Van Lierde
@webketje
@qg:supercable.onl what is your GH handle, so I can add you to an "ideation" team on metalsmith (where you can follow new ideas before they become GH issues)
1 reply
Kevin Van Lierde
@webketje
Let's see if we can start a synergy with StartBootstrap StartBootstrap/startbootstrap-clean-blog#138
2 replies
qg
@qg:supercable.onl
[m]
Oh, I think that's fine. It saves you from the headache was it ../ or ../../ or ...
Kevin Van Lierde
@webketje
PS: just released @metalsmith/postcss, the original authors didn't respond
1 reply
Kevin Van Lierde
@webketje
Looking at JS Maps, they would probably provide a better DX for v3 for the Files object.
Then you could add/ remove files like
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]
3 replies
qg
@qg:supercable.onl
[m]
Oh, interesting.
Maybe there could be a compatibility layer indeed. Maybe there could even be some sort of versioning scheme for plugins so old ones don't immediately break, but new ones can make native use of new data structures. Either way, the overhead needs to be considered and it should stay as small as possible, obviously.
Kevin Van Lierde
@webketje
qg
@qg:supercable.onl
[m]
I meant in a way that multiple restructuring/remapping/... operations could be a performance hit at some point, the more files and the more plugins the more significant.
Kevin Van Lierde
@webketje
Actually, maps (theoretically) are more performant when a lot of property reassignment happens. I suppose that's because vendors are able to enhance perf behind the get/set/delete/has/... etc methods
qg
@qg:supercable.onl
[m]
Would using them break old plugins?
Kevin Van Lierde
@webketje
Absolutely, it would break every plugin. You can only alter maps through their methods.. no direct assignment, no delete. You also can't use any of the Object static methods on it (Object.entries/keys/values)
qg
@qg:supercable.onl
[m]
Well, that's the issue. To prevent that, there'd need to be some compatibility layer or plugin versioning. And that overhead might be a (small enough) performance hit.
werner glinka
@wernerglinka_twitter
We have to consider that Metalsmith has just returned from the dead. Having an active new maintainer is a blessing, but a change that breaks all plugins will turn a lot of users away.
Kevin Van Lierde
@webketje
Yeah Map is great but IMO it's not feasible for the short-term.. Maybe in v5 :D
werner glinka
@wernerglinka_twitter
Reminds me of the Drupal vs Wordpress adoption. Drupal introduced major breaking changes with every major version release, Wordpress always maintained backwards compatibility. Drupal’s adoption rate went down after every major version change, people switch to Wordpress.
qg
@qg:supercable.onl
[m]
I agree somehow, but on the other hand, now are many plugins already quite outdated and due to a refresh (although they might still work, but no updated dependencies in years is just ugh).
werner glinka
@wernerglinka_twitter
Yup, long term is better if this brings real tangible gains for the developer. But will need to plan that at that time all core and other major plugins are available for the new MS version.
Good point @qg but I believe MS needs to project stability at this point.
qg
@qg:supercable.onl
[m]
Best would be not to break existing plugins anytime soon indeed. Maybe there could be some sort of .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 overhead
Of course this should rather be hidden away at best so each plugin can define its version somehow itself and not depending on how it is called.
Kevin Van Lierde
@webketje
@qg:supercable.onl sth like this can only be justified with significant differences in a perf benchmark. The "transition" period, which could turn out to be rather long, would necessarily add overhead to all builds
qg
@qg:supercable.onl
[m]
Sure, it would add overhead, but it might be worth it to introduce new things at some point without breaking the old plugins.
Kevin Van Lierde
@webketje
The Map API is definitely a big win in DX
It's doing pretty well right now anyway:
image.png
qg
@qg:supercable.onl
[m]
Wow! 👍
Kevin Van Lierde
@webketje
Other monthly stats: +80 GH stars, 2k page views, 1k unique users
werner glinka
@wernerglinka_twitter
Other projects will maintain both versions for a transition period, that gives plugin maintainers time to do their deed
Kevin Van Lierde
@webketje
I think that might require pinging the plugin authors personally, a lot of the most used ones only semi-actively maintain their plugins (as in once every year)
werner glinka
@wernerglinka_twitter
Yes, some buy-in would be helpful
Kevin Van Lierde
@webketje
Meh! did a quick test and metalsmith (core, not plugins) actually works with Deno when you run it like deno run --compat --unstable --allow-read --allow-env metalsmith.js
walletsecured
@walletsecured
hi everyone, please am new here and new to this
Kevin Van Lierde
@webketje
@walletsecured welcome & enjoy!
Kevin Van Lierde
@webketje
Working on powerful 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'
          }
        }
      }
    ])
  )
Levi Wheatcroft
@leviwheatcroft
@webketje Hey I just saw the issue you posted for metalsmith-debug-ui. I personally always thought debugUi was freakin awesome but genuinely surprised to hear anyone is still using it. I've kind of moved on from ms but I'm open to the idea of refactoring debugUi.
@webketje That said, you're certainly correct that debugUi does some unorthodox (hacky) things patching the ms build fn to get the snapshots. If you have plans for a plugin to generate snapshots, then as you said it would be best for debugUi to use that internally. So if I were to publish a new version it would probably be best to wait until after that.
Kevin Van Lierde
@webketje
@leviwheatcroft It is freaking awesome (just like metalsmith)! I used it recently for debugging the metalsmith.io website, and it also inspired me for an idea for a CMS frontend (generating a folder at eg /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.
After nearly 2 years of dialogue with the other lead maintainers (Ismay & woodyg) & Segment we finally got ownership & going full speed since December 2021 (NPM downloads for the latest versions reached half of what 2.3.0 had in 5 years in only a month). So it's not too late too come back ;)
Kevin Van Lierde
@webketje
New metalsmith core plugin! https://github.com/metalsmith/requests
werner glinka
@wernerglinka_twitter
@webketje NICE, this is a great addition. Metadata is starting to feel like a data layer, much like they have in Gatsby, without the Graphql. I prefer to access data as JS objects anyway.
werner glinka
@wernerglinka_twitter
I wrote about a responsive/progressive image component for Metalsmith. The component is build with Nunjucks but the principle can easily be used for other template languages as well. Makes the use of responsive images very easy.
werner glinka
@wernerglinka_twitter
I published a set of Starters, from a bare-bone for someone who is just starting to a company starter with flexible page layouts. The flexible layouts starter is also discussed in a new blogpost https://www.glinka.co/blog/building-flexible-page-layouts/. Finally, since metalsmith-assets is dead I build a new plugin https://github.com/wernerglinka/metalsmith-static that does the same but is up-to-date.
I'll be updating the awesome metalsmith part of metalsmith.io soon. Please let me know if you have anything, blogposts, starters, plugins that should be listed there.
werner glinka
@wernerglinka_twitter
Do you want to use NetlifyCMS for your Metalsmith site? Read here how to get started
Kevin Van Lierde
@webketje

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:

  1. How is a user supposed to enable/disable the log? Options are, 1) through a dedicated env var metalsmith.env('DEBUG_LOG', true), 2) depending on the value of metalsmith.env('NAME') // or NODE_ENV (log when !== 'production').
  2. Where should the log be generated? in the working dir or the build? Do users need to be able to control the location of the log file? ATM I'm leaning towards the working dir as it's not really part of the build.

I don't want to add a metalsmith.log function as it would be confusing/ overlap with metalsmith.debug/ env functionality

Kevin Van Lierde
@webketje
Yesterday the product owner wrote Metalsmith as a technical solution in a spec document. If this works out, I could work on bringing together the best of static site generators together with a Node Express backend and a front-end framework. I want to prove how valuable this approach can be compared to "holistic" SSGs like NuxtJs which encourage you to mix everything (front and backend logic, i18n, etc).
This would provide an exciting opportunity to work on plugins (multilingual) and also a setup where part of the site is only accessible as authenticated user
werner glinka
@wernerglinka_twitter
Keep in mind the sectioned pages approach. A simple “all text in the content area” will not cut it😎
Kevin Van Lierde
@webketje
@wernerglinka_twitter yes, I will refer to your blogs/ examples when I get to that part!
Kevin Van Lierde
@webketje
Info: On May 3rd, Jon Kulton wrote an article about https://httpstatuses.io (a useful site which lists all HTTP status codes) and mentioned his fork was built with Metalsmith. This produced a 250% spike in traffic!
Kevin Van Lierde
@webketje
Good news: I got publish access to jstransformer-nunjucks, will be updating nunjucks version to latest soon