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

5.x: unique content sources for each build environment #1385

Open
cossssmin opened this issue Nov 26, 2024 · 0 comments
Open

5.x: unique content sources for each build environment #1385

cossssmin opened this issue Nov 26, 2024 · 0 comments

Comments

@cossssmin
Copy link
Member

Because we now use globs for content sources (similar to Tailwind CSS v3), the environment config merging strategy falls short in some cases. For example, consider the following setup:

config.js

export default {
  build: {
    content: ['src/templates/**/*.html'],
  }
}

config.sendgrid.js

export default {
  build: {
    content: ['src/templates/sendgrid/**/*.html'],
  }
}

Normally, when we run maizzle build sendgrid we'd expect it to just build our Sendgrid templates.

However, if src/templates also contains some assets folders, like say images, then because of the config merging the src/images folder will also be considered a templates source.

That would work, as in the folder would just get copied over and the build would succeed.

However, we'd get a build output folder with this structure:

build_sendgrid
|-- sendgrid
|-- images

When in fact we just want this:

build_sendgrid
|-- sendgrid

Solution

To fix this we could try to not merge the build.content keys, effectively overriding the one you have in config.js.

This would be a breaking change if you're relying on the merging strategy when building for production, i.e. you need templates defined in build.content from config.js and are just adding sources to it - in this case you'd need to always define all of your content sources in each config file.

Note: I ran into this a few times while working on real life projects with v5 beta, but I might be biased in the way I use it, so leaving this open for now - input is appreciated 👍

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

No branches or pull requests

1 participant