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

Add examples for bundleExportKey feature to docs #28

Open
zachleat opened this issue Jul 5, 2024 · 0 comments
Open

Add examples for bundleExportKey feature to docs #28

zachleat opened this issue Jul 5, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@zachleat
Copy link
Member

zachleat commented Jul 5, 2024

bundleExportKey: "bundle" (default) means that you can do this in your 11ty.js template:

export const bundle = {
	css: "/* Only adds to css bundle */"
};

export function render() {};
export function data() {};

This works with buckets too, if you nest another object in your export:

export const bundle = {
  css: {
    default: "/* Only adds to default bucket in css bundle */"
  }
};

This works too but probably isn’t what you want:

export const bundle = "/* Adds to all bundles using bundleExportKey: "bundle" */";

This makes more sense, if you want to opt-in to something a bit simpler with a string export direct to a bundle:

bundleExportKey: "css" means that you can do this in your 11ty.js template:

export const css = "/* Some CSS */";
@zachleat zachleat added the documentation Improvements or additions to documentation label Jul 5, 2024
@zachleat zachleat changed the title Add example for bundleExportKey feature to docs Add examples for bundleExportKey feature to docs Jul 5, 2024
zachleat added a commit that referenced this issue Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant