https://github.com/vanillaes/interpolate
Interpret JavaScript tagged literal templates
https://github.com/vanillaes/interpolate
esm esmodules javascript template-engine
Last synced: 17 days ago
JSON representation
Interpret JavaScript tagged literal templates
- Host: GitHub
- URL: https://github.com/vanillaes/interpolate
- Owner: vanillaes
- License: mit
- Created: 2019-12-09T19:10:01.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2021-11-15T23:26:53.000Z (about 4 years ago)
- Last Synced: 2025-09-26T13:58:41.401Z (5 months ago)
- Topics: esm, esmodules, javascript, template-engine
- Language: JavaScript
- Homepage:
- Size: 604 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Interpolate
A small, easy-to-use template literal builder. Good for loading template literal strings from external sources.
# Features
- ECMAScript Module
- Typescript Compatible
- Tiny Footprint (1K)
## Imports
This package works isomorphically in browser and server-side JavaScript
### Browser
Import directly from the local path or a CDN
```html
import { interpolate } from 'path/to/interpolate/index.js'
```
The minified version can be imported from
```html
import { interpolate } from 'path/to/interpolate/index.min.js'
```
### Node
Install the package
```sh
npm install @vanillaes/interpolate
```
Import using the module path
```javascript
import { interpolate } from '@vanillaes/interpolate'
```
## Interpolate()
Builds a string from a template string + tags collection.
### Arguments
```Interpolate(template, {tags})```
- template - the template literal string
- tags - the tagged values in the template
## Typings
Typings are generated from JSDoc using Typescript. They are 100% compatible with VSCode Intellisense and will work seamlessly with Typescript.