Skip to content

Commit

Permalink
fixed Nunjucks template cache
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Nov 22, 2022
1 parent 5c53f37 commit bb2232e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/),
and this project adheres to [Semantic Versioning](https://semver.org/).

## [1.13.1] - Unreleased
## [1.13.1] - 2022-11-22
### Removed
- `Page.isHtml` property added in v1.13.0.
- The `Page.isHtml` property added in v1.13.0.

### Fixed
- Updated the dependencies: `std`, `minify_html`, `sheetjs`.
Expand All @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
- Import `lightningcss` from npm.
- Load a fixed version of `prism` to avoid deno.lock errors.
- Live reload: use `wss://` protocol under `https://` [#316].
- Some Nunjucks template caches not cleaned after changes in watch mode.

## [1.13.0] - 2022-11-16
### Added
Expand Down Expand Up @@ -1919,7 +1920,7 @@ The first version.
[#308]: https://github.com/lumeland/lume/issues/308
[#316]: https://github.com/lumeland/lume/issues/316

[1.13.1]: https://github.com/lumeland/lume/compare/v1.13.0...HEAD
[1.13.1]: https://github.com/lumeland/lume/compare/v1.13.0...v1.13.1
[1.13.0]: https://github.com/lumeland/lume/compare/v1.12.1...v1.13.0
[1.12.1]: https://github.com/lumeland/lume/compare/v1.12.0...v1.12.1
[1.12.0]: https://github.com/lumeland/lume/compare/v1.11.4...v1.12.0
Expand Down
8 changes: 8 additions & 0 deletions plugins/nunjucks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ export class NunjucksEngine implements Engine {
if (name) {
delete fsLoader.cache[name];
}

// Relative paths
fsLoader.searchPaths.forEach((path: string) => {
if (filename.startsWith(path)) {
const name = filename.slice(path.length + 1);
delete fsLoader.cache[name];
}
});
}

render(content: string, data?: Data, filename?: string) {
Expand Down

0 comments on commit bb2232e

Please sign in to comment.