Comments (1)
Answering my own question:
Solution:
...
"variables": {
"shortenName": function () {
return function (val, render) {
let new_val = render(val);
return new_val.replace("icon__", "");
}
},
}
<!-- in sprite.html -->
<div>{{#shortenName}}{{name}}{{/shortenName}}</div>
My mistake was in trying to pass the value to the top-level function for 'shortenName()', instead of using the 'render' function.
from svg-sprite.
Related Issues (20)
- `--symbol-render-*` (maybe all custom templates) does not work from CLI HOT 2
- Refactor `bin/svg-sprite.js`
- id and class get a weird prefix. HOT 1
- passing null for name to add function causes TypeError HOT 3
- Lodash.trim depdendency has an NPM audit warning HOT 1
- `masterShapes` does not sorted. HOT 2
- i am starting to work on unplugin-svg-sprite project HOT 5
- Adding template helper with config-file?
- Issue with @keyframes in SVG style tag HOT 1
- [v2.0.2] - Can we upgrade v2.0.2 to have lodash version that fixes the lodash.trim vulnerability HOT 6
- Spread in the path for svgo custom plugins
- Output sprite empty after migrating to v3 HOT 4
- Set custom path and output file name
- Update css-selector-parser in main
- Glob - Inflight - Missing Release of Resource after Effective Lifetime HOT 1
- Spriter's Shape Transform Method Only Running First Transformation in shape.transform Array. Again HOT 2
- COORDINATE MAP HOT 2
- I want to do this , but i don't know what i shoud do
- issue with async - callback was already called
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svg-sprite.