Skip to content

Commit

Permalink
feat: add templateVars parameter to css option. (#222)
Browse files Browse the repository at this point in the history
* Spreading templateVars in copy in utils.ts

* Adding CSS templateVars to README
  • Loading branch information
stevematney authored Mar 7, 2024
1 parent af1f3b5 commit 2d70942
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ type CSSOptions = {
* https://github.com/jaywcjlove/svgtofont/issues/48#issuecomment-739547189
*/
fileName?: string
/**
* Ad hoc template variables.
*/
templateVars?: Record<string, any>;
}
```
Expand Down
5 changes: 5 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ export type CSSOptions = {
* https://github.com/jaywcjlove/svgtofont/issues/48#issuecomment-739547189
*/
fileName?: string;
/**
* Ad hoc template variables.
*/
templateVars?: Record<string, any>;
}

/**
Expand All @@ -287,6 +291,7 @@ export function copyTemplate(inDir: string, outDir: string, { _opts, ...vars }:
const removeFiles: Array<string> = [];
return new Promise((resolve, reject) => {
copy(inDir, outDir, {
...(_opts.templateVars || {}),
...vars,
cssPath: _opts.cssPath || '',
filename: _opts.fileName || vars.fontname,
Expand Down

0 comments on commit 2d70942

Please sign in to comment.