TL;DR
The main enhancement this feature brings is the ability to include partials with an absolute path! This is a feature that EJS users have been requesting for a while, but we got it first 😉 🎉.
When Eta is looking for a template with an absolute path, it will first look in config.views
, then fall back to config.root
(which is, by default, "/"
). The main advantage of this approach is that it means most users will not have to manually set config.root
(which can cause confusing problems).
Summary of other changes:
- If Eta can't find a template file, the error it throws now includes a list of filepaths it checked
- Removed unnecessary
includeHelper.bind(config)
andincludeFileHelper.bind(config)
statements - More tests
- README formatting updates
- Wrap the
readFile
function in atry {} catch {}
block, so if you pass an incorrect path torenderFile
the error will look nicer
Commits
- Test that getConfig returns a clone of config when called w/ no arguments 5c4f20c
- Merge pull request #16 from eta-dev/fix-helper-bind 3860018
- Remove .bind() calls that didn't do anything d2d179f
- Fix README alignment issues 8568932
- Merge branch 'master' of github.com:eta-dev/eta into master 733b150
- Merge pull request #15 from eta-dev/fix-abs-root 0d3501d
- Rebuild after file-handling changes 85ea879
- Edit error message tests to reflect current errors bb417a5
- First search options.views for absolute paths, then fallback to root. Create a list of searched paths 243a998
- Wrap readFile in a try-catch cabd4b3
- Move buildRegEx function to test/err.spec.ts f7b84cf
- Change div around badges to p so it centers correctly on NPM 0a41b7c
- Remove deno doc badge; deno doc doesn't support bracketed exports, so it's basically useless for Eta 37bb224