Skip to content

Commit ee84706

Browse files
committed
update README and docs about v6 breaking changes
1 parent a2f07b3 commit ee84706

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ Jet is a template engine developed to be easy to use, powerful, dynamic, yet sec
1212
* very fast execution – Jet can execute templates faster than some pre-compiled template engines
1313
* very light in terms of allocations and memory footprint
1414

15-
## v4
15+
## v6
1616

17-
Version 4 brings a lot of bug fixes and improvements as well as [updated documentation](./docs/index.md), but make sure to read through the [breaking changes](./docs/changes.md) before making the jump.
17+
Version 6 brings major improvements to the Go API. Make sure to read through the [breaking changes](./docs/changes.md) before making the jump.
1818

1919
## Docs
2020

21+
- [Go API](https://beta.pkg.go.dev/github.com/CloudyKit/jet/v6)
2122
- [Syntax Reference](./docs/syntax.md)
2223
- [Built-ins](./docs/builtins.md)
2324
- [Wiki](https://github.com/CloudyKit/jet/wiki) (some things are out of date)
2425

2526
## Example application
2627

27-
An example application is available in the repository. Use `go get -u github.com/CloudyKit/jet` or clone the repository into `$GOPATH/github.com/CloudyKit/jet`, then do:
28+
An example to-do application is available in [examples/todos](./examples/todos). Clone the repository, then (in the repository root) do:
2829
```
2930
$ cd examples/todos; go run main.go
3031
```

docs/changes.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,36 @@
11
# Breaking Changes
22

3+
## v6
4+
5+
When udpating from version 5 to version 6, there are breaking changes to the Go API:
6+
7+
- Set's LoadTemplate() method was removed
8+
9+
LoadTemplate() (which used to parse and cache a template while bypassing the Set's Loader) is removed in favor of the [new in-memory Loader](https://godoc.org/github.com/CloudyKit/jet#InMemLoader) where you can add templates on-the-fly (which is also used for tests without template files). Using it together with a file Loader via a MultiLoader restores the previous functionality: having template files accessed via the Loader and purely in-memory templates on top of those. [#182](https://github.com/CloudyKit/jet/pull/182)
10+
11+
- Loader interface changed
12+
13+
A Loader's Exists() method does not return the path to the template if it was found. Jet doesn't really care about what path the Loader implementation uses to locate the template. Jet expects the Loader to guarantee that the path it tried in Exists() to also work in calls to Open(), when the Exists() call returned true. [#183](https://github.com/CloudyKit/jet/pull/183)
14+
15+
- a new Cache interface was introduced
16+
17+
Previously, it was impossible to control if and how long a Set caches templates it parsed after fetching them via the Loader. Now, you can pass a custom Cache implementation to have complete control over caching behavior, for example to invalidate a cached template and making a Set re-fetch it via the Loader and re-parse it. [#183](https://github.com/CloudyKit/jet/pull/183)
18+
19+
- new NewSet() with option functions
20+
21+
The different functions used to create a Set (NewSet, NewSetLoader, NewHTMLSet, NewHTMLSetLoader()) have been removed in favor of a single NewSet() function that requires only a loader and accepts any number of configuration options in the form of option functions. When not passing any options, NewSet() will now use the HTML safe writer by default.
22+
23+
- SetDevelopmentMode(), Delims(), SetExtensions() converted to option functions
24+
25+
The new InDevelopmentMode(), WithDelims() and WithTemplateNameExtensions() option functions replace the previous functions. This means you can't change these settings after the Set is created, which was very likely not a good idea anyway.
26+
27+
If you toggle development mode after Set creation, you can now use a custom Cache to configure cache-use on the fly. Since this is all the development mode does anyway, the InDevelopmentMode() option might be removed in a future major version of Jet.
28+
29+
There are no breaking changes to the template language.
30+
331
## v5
432

5-
When updating from version 4 to version 5, there is a breaking changes:
33+
When updating from version 4 to version 5, there is a breaking change:
634

735
- `_` became a reserved symbol
836

examples/todos/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
var views = jet.NewSet(
3232
jet.NewOSFileSystemLoader("./views"),
3333
jet.InDevelopmentMode(), // remove in production
34-
3534
)
3635

3736
type tTODO struct {

0 commit comments

Comments
 (0)