njk-cli / njk Goto Github PK
View Code? Open in Web Editor NEWRender nunjucks templates with markdown and front-matter
Home Page: https://www.npmjs.com/package/njk
License: MIT License
Render nunjucks templates with markdown and front-matter
Home Page: https://www.npmjs.com/package/njk
License: MIT License
sad to hear njk is no longer receiving lts. i enjoyed it while it lasted. may i ask what alternatives you are using?
I really wish this package would work like it claims to.
Here's the command line I'm trying to run
njk ./content -t ./templates -o _site/
I have .md
files in ./content
, .njk
templates in ./templates
and expecting everything to bundle up nicely in _site/
. Instead, globby
throws an error.
throw new TypeError('Patterns must be a string or an array of strings');
It looks like your package uses globby.sync
twice, the first one seems to have the ['./content']
argument I'm passing but the second time around assigning -t ./templates
just sends in undefined
. I can see my process.argv
is passing in all the arguments that I'm sending. Looks like your commander
losing them.
When using njk src/html/*.html --out dist
files are being created in dist/src/html
instead of directly to dist
. So, for example src/html/index.html
gets output to dist/src/html/index.html
.
Is it possible to get the output to be dist/index.html
instead of including the extra source folders? Thanks for the great CLI tool!
When using either of the following npm scripts, nothing gets built:
"njk 'src/html/*.html'"
"njk \"src/html/*.html\""
A number of CLI tools (ex. https://eslint.org/docs/user-guide/command-line-interface) recommend double quoting globs (which are escaped in the second example above) to ensure proper Windows support.
I'm pretty frequently getting messages like the following and an empty file when running in watch mode on Ubuntu 18.10:
ℹ Changed template src/html/index.html
⚠ Failed to render src/html/index.html, null output
✔ Wrote index.html
If I save the file again, it seems to build correctly. I also have the verbose
flag enabled, but those are the only messages I'm seeing.
I think it might be related to babel/babel#4332 and postcss/postcss-cli#215, which were both fixed by adding awaitWriteFinish
options to chokidar.watch
.
One small point of confusion I had while migrating over from a different Nunjucks tool was the --template CLI option. After looking through the source, I realized that it seems to work the same as searchPaths (https://mozilla.github.io/nunjucks/api.html#filesystemloader).
You might consider renaming that to match or adding a note to help avoid similar confusion in the future.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.