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 options to omit and skip templates #851

Merged
merged 5 commits into from
Dec 10, 2022
Merged

Conversation

cossssmin
Copy link
Member

@cossssmin cossssmin commented Dec 7, 2022

This PR adds two new options to build.templates: omit and skip.

omit

This can be used to define paths to files or directories from your source that should not be copied over to the build destination.

For example, imagine your project's src/templates contained these files:

src/templates
├── 1.html
├── 2.html
└── archive
    ├── 3.html
    └── 4.html

You can prevent 1.html and 4.html from being copied to the build destination like this:

module.exports = {
  build: {
    templates: {
      source: 'src/templates',
      omit: ['1.html', 'archive/4.html'],
      // ...
    }
  }
}

In this case, running maizzle build production would create a build_production folder with these files inside:

build_production
├── 2.html
└── archive
    ├── 3.html

It supports directory paths, so you can omit the entire archive folder:

module.exports = {
  build: {
    templates: {
      source: 'src/templates',
      omit: ['1.html', 'archive'],
      // ...
    }
  }
}

The result would be:

build_production
├── 2.html

skip

Use the new skip option if you want to skip the compilation of a template. The file will only be copied as-is to the build destination, it will not be parsed in any way by Maizzle.

module.exports = {
  build: {
    templates: {
      source: 'src/templates',
      skip: ['1.html', 'archive/3.html'],
      // ...
    }
  }
}

skip can be a string (excludes just one template) or an array of strings like in the example above.

Each string must be a file path that is relative to your templates.source directory.

@cossssmin cossssmin changed the title feat: exclude templates from compilation Add options to omit and skip templates Dec 10, 2022
@cossssmin cossssmin merged commit 9ebe6f6 into next Dec 10, 2022
@cossssmin cossssmin deleted the feat/exclude-templates branch December 10, 2022 16:58
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.

None yet

1 participant