https://github.com/seldszar/skana
Namespace-based loader for Nunjucks.
https://github.com/seldszar/skana
javascript loader namespaces nodejs nunjucks
Last synced: 28 days ago
JSON representation
Namespace-based loader for Nunjucks.
- Host: GitHub
- URL: https://github.com/seldszar/skana
- Owner: Seldszar
- License: mit
- Created: 2018-05-04T13:04:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-01T01:15:42.000Z (almost 8 years ago)
- Last Synced: 2025-09-22T22:30:25.895Z (8 months ago)
- Topics: javascript, loader, namespaces, nodejs, nunjucks
- Language: JavaScript
- Homepage:
- Size: 66.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Skana
> This simple blade becomes immensely powerful in the hands of a master.
Namespace-based loader for Nunjucks.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [API](#api)
- [Author](#author)
- [License](#license)
## Installation
```bash
npm install skana --save
```
## Usage
```javascript
const nunjucks = require('nunjucks');
const skana = require('skana');
const env = new nunjucks.Environment(
new skana.FileSystemLoader(namespace => {
switch (namespace) {
case "lorem": {
return [
"/path/to/lorem/views",
];
}
case "ipsum": {
return [
"/path/to/ipsum/views",
];
}
default: {
return [
"/path/to/default/views",
];
}
}
}),
);
// Resolve and synchronously render
const result = env.render("my-view.html");
// Resolve and asynchronously render
env.render("@lorem/my-view.html", (error, result) => {
// ...
});
```
# API
See the detailed [API Reference](API.md).
## Author
Alexandre Breteau - [@0xSeldszar](https://twitter.com/0xSeldszar)
## License
MIT © [Alexandre Breteau](https://seldszar.fr)