项目作者: vanillaes

项目描述 :
Interpret JavaScript tagged literal templates
高级语言: JavaScript
项目地址: git://github.com/vanillaes/interpolate.git
创建时间: 2019-12-09T19:10:01Z
项目社区:https://github.com/vanillaes/interpolate

开源协议:MIT License

下载


Interpolate

A small, easy-to-use template literal builder. Good for loading template literal strings from external sources.


GitHub Release
NPM Release
Bundlephobia
Latest Status
Release Status

Discord

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

  1. <script type="module">
  2. import { interpolate } from 'path/to/interpolate/index.js'
  3. </script>

The minified version can be imported from

  1. <script type="module">
  2. import { interpolate } from 'path/to/interpolate/index.min.js'
  3. </script>

Node

Install the package

  1. npm install @vanillaes/interpolate

Import using the module path

  1. 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.