Skip to content

Commit

Permalink
ignore automatially the includes folders
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Nov 6, 2023
1 parent 478d039 commit 1f5a40d
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 5 deletions.
18 changes: 18 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
- Removed `window.React` #332.
- New option `pageSubExtension`.
- Changed `extensions` option type to `string[]`.
- The `includes` folder is automatically ignored.

## `slugify_urls` Plugin

Expand All @@ -75,13 +76,15 @@

- New option `useDefaultPlugins` that it's `true` by default.
- Removed `keepDefaultPlugins`
- The `includes` folder is automatically ignored.

## `mdx` Plugin

- Updated to MDX v3.
- New option `useDefaultPlugins` that it's `true` by default.
- Removed `overrideDefaultPlugins`
- Removed `pragma` option.
- The `includes` folder is automatically ignored.

## `remark` Plugin

Expand All @@ -93,11 +96,13 @@
- New option `pageSubExtension`.
- Changed `extensions` option type to `string[]`.
- Replaced `.tmpl` subextension with `.page`.
- The `includes` folder is automatically ignored.

## `eta` Plugin

- New option `pageSubExtension`.
- Changed `extensions` option type to `string[]`.
- The `includes` folder is automatically ignored.

## `json` Plugin

Expand All @@ -109,29 +114,42 @@

- New option `pageSubExtension`.
- Changed `extensions` option type to `string[]`.
- The `includes` folder is automatically ignored.

## `liquid` Plugin

- New option `pageSubExtension`.
- Changed `extensions` option type to `string[]`.
- The `includes` folder is automatically ignored.

## `nunjucks` Plugin

- Disabled by default
- New option `pageSubExtension`.
- Changed `extensions` option type to `string[]`.
- The `includes` folder is automatically ignored.

## `pug` Plugin

- New option `pageSubExtension`.
- Changed `extensions` option type to `string[]`.
- The `includes` folder is automatically ignored.

## `vento` Plugin

- Enabled by default
- New option `pageSubExtension`.
- Changed `extensions` option type to `string[]`.
- The `includes` folder is automatically ignored.

## `multilanguage` Plugin

- Apply the default language to all pages without defined language.

## `sass` Plugin

- The `includes` folder is automatically ignored.

## `lightningcss` Plugin

- The `includes` folder is automatically ignored.
6 changes: 6 additions & 0 deletions plugins/eta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ export default function (userOptions?: Partial<Options>) {

const engine = new EtaEngine(eta, site.src(), options.includes);

// Ignore includes folder
if (options.includes) {
site.ignore(options.includes);
}

// Load the pages and register the engine
site.loadPages(options.extensions, {
loader,
engine,
Expand Down
7 changes: 7 additions & 0 deletions plugins/jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,15 @@ export default function (userOptions?: Partial<Options>) {
{ ...defaults, includes: site.options.includes },
userOptions,
);

const engine = new JsxEngine(site.src("/"), options.includes);

// Ignore includes folder
if (options.includes) {
site.ignore(options.includes);
}

// Load the pages and register the engine
site.loadPages(options.extensions, {
loader,
engine,
Expand Down
6 changes: 6 additions & 0 deletions plugins/jsx_preact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ export default function (userOptions?: Partial<Options>) {

const engine = new PreactJsxEngine(site.src(), options.includes);

// Ignore includes folder
if (options.includes) {
site.ignore(options.includes);
}

// Load the pages and register the engine
site.loadPages(options.extensions, {
loader,
engine,
Expand Down
1 change: 1 addition & 0 deletions plugins/lightningcss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default function (userOptions?: DeepPartial<Options>) {

if (options.includes) {
site.processAll(options.extensions, lightningCSSBundler);
site.ignore(options.includes);
} else {
site.process(options.extensions, lightningCSSTransformer);
}
Expand Down
6 changes: 6 additions & 0 deletions plugins/liquid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ export default function (userOptions?: DeepPartial<Options>) {
options.includes,
);

// Ignore includes folder
if (options.includes) {
site.ignore(options.includes);
}

// Load the pages and register the engine
site.loadPages(options.extensions, {
loader,
engine,
Expand Down
8 changes: 7 additions & 1 deletion plugins/mdx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,14 @@ export default function (userOptions?: Partial<Options>) {
);
}

// Load the pages
const engine = new MDXEngine(site.src(), options, format.engines[0]);

// Ignore includes folder
if (options.includes) {
site.ignore(options.includes);
}

// Load the pages and register the engine
site.loadPages(options.extensions, {
loader,
engine,
Expand Down
8 changes: 8 additions & 0 deletions plugins/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,15 @@ export default function (userOptions?: Partial<Options>) {

const engine = new ModuleEngine(options.includes);

// Ignore includes folder
if (options.includes) {
site.ignore(options.includes);
}

// Load the _data files
site.loadData(options.extensions, loader);

// Load the pages and register the engine
site.loadPages(options.extensions, {
loader,
engine,
Expand Down
6 changes: 6 additions & 0 deletions plugins/nunjucks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ export default function (userOptions?: DeepPartial<Options>) {

const engine = new NunjucksEngine(env, site.src(), options.includes);

// Ignore includes folder
if (options.includes) {
site.ignore(options.includes);
}

// Load the pages and register the engine
site.loadPages(options.extensions, {
loader,
engine,
Expand Down
1 change: 1 addition & 0 deletions plugins/postcss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default function (userOptions?: Partial<Options>) {

if (options.includes) {
plugins.unshift(configureImport(site, options.includes));
site.ignore(options.includes);
}

// @ts-ignore: Argument of type 'unknown[]' is not assignable to parameter of type 'AcceptedPlugin[]'.
Expand Down
6 changes: 6 additions & 0 deletions plugins/pug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ export default function (userOptions?: DeepPartial<Options>) {
options.options,
);

// Ignore includes folder
if (options.includes) {
site.ignore(options.includes);
}

// Load the pages and register the engine
site.loadPages(options.extensions, {
loader,
engine,
Expand Down
6 changes: 6 additions & 0 deletions plugins/sass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export default function (userOptions?: Partial<Options>) {
userOptions,
);

// Ignore includes folder
if (options.includes) {
site.ignore(options.includes);
}

// Load & process the assets
site.loadAssets(options.extensions);
site.process(options.extensions, sass);

Expand Down
7 changes: 7 additions & 0 deletions plugins/vento.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,18 @@ export default function (userOptions?: Partial<Options>) {

const ventoEngine = new VentoEngine(vento, options.includes);

// Ignore includes folder
if (options.includes) {
site.ignore(options.includes);
}

// Load the pages and register the engine
site.loadPages(options.extensions, {
loader,
engine: ventoEngine,
subExtension: options.pageSubExtension,
});

site.filter("vto", filter as Helper, true);

async function filter(string: string, data?: Data) {
Expand Down
8 changes: 4 additions & 4 deletions tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,27 @@ Deno.test("ignored files configuration", () => {
const site = lume();
const { ignored, filters } = site.source;

equals(ignored.size, 6);
equals(ignored.size, 7);
equals(filters.length, 0);
equals(ignored.has("/node_modules"), true);
equals(ignored.has("/_site"), true);
equals(ignored.has("/import_map.json"), true);
equals(ignored.has("/deno.json"), true);

site.ignore("README.md");
equals(ignored.size, 7);
equals(ignored.size, 8);
equals(filters.length, 0);
equals(ignored.has("/README.md"), true);

site.ignore("file2", "file3", "README.md");
equals(ignored.size, 9);
equals(ignored.size, 10);
equals(filters.length, 0);
equals(ignored.has("/file2"), true);
equals(ignored.has("/file3"), true);

const filter = (path: string) => path.includes("file");
site.ignore(filter);
equals(ignored.size, 9);
equals(ignored.size, 10);
equals(filters.length, 1);
equals(filters[0], filter);
});
Expand Down

0 comments on commit 1f5a40d

Please sign in to comment.