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

Organised eleventy #1004

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Organised eleventy #1004

wants to merge 8 commits into from

Conversation

jbarnardmoj
Copy link
Contributor

Pull-request templates

Please follow the steps below to tell us about your contribution.

  1. Copy the correct template for your contribution
  1. Replace this text with the contents of the template
  2. Fill in all sections of the template
  3. Click "Create pull request".

@chrispymm
Copy link
Contributor

I think this PR goes a bit further than I anticipated, and IMO ends up with a slightly unreadable .eleventy.js file - it feels like it ends up being hard to scan that file and see what filters / shortcodes are enabled and most importantly the string I need to use to invoke them, which isn't ideal.

I think I was expecting each extracted filter/shortcode to export the filter/shortcode function, and then the eleventy config file would still have the addShortcode definition bit

const tabs = require('shortcodes/tabs.js')

eleventyConfig.addPairedShortcode("tabs", tabs)

This extracts away the implementation, but leaves someone able to read the eleventy config file and see what shortcodes and filters are available to them, and how to invoke them.

This may cause scoping issues for the tabs / tab shortcode though...

I think if we can't do the above I'd still prefer manually requiring each file within .eleventy.js rather than looping through a directory

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

Successfully merging this pull request may close these issues.

2 participants