Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sobird/replace-tpl
Replaces a template strings with variables.
https://github.com/sobird/replace-tpl
Last synced: 6 days ago
JSON representation
Replaces a template strings with variables.
- Host: GitHub
- URL: https://github.com/sobird/replace-tpl
- Owner: sobird
- License: mit
- Created: 2020-10-09T07:29:44.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-13T08:14:40.000Z (about 4 years ago)
- Last Synced: 2024-03-21T22:43:41.387Z (10 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# replace-tpl
Replaces a template strings with variables.## Usage
```js
const replaceTpl = require('replace-tpl');var pathTpl = '@/[name].[hash:8].js';
var newPath = replaceTpl(pathTpl, {
at: '/some/dir',
name: 'foo',
hash: 'de56437c1e9544aa2521352dcdf26cb160093e52d4ea565cdf0d2bb279e22d12',
});console.log(newPath); // /some/dir/foo.de56437c.js
```## API
replaceTpl(path, data)