Comments (10)
🥇
The Maker.js GitHub is ok for general discussion 😃
from svgson.
thanks @danmarshall, super happy about your words!
I am wondering if you have a JSON schema for the output format of the parse function?
Not really but thougt about it.
The output folllows this tree
structure:
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Element name, like svg, circle, line…"
},
"type": {
"type": "string",
"description": "Element type like element, text…"
},
"value": {
"type": "string",
"description": "Element value, used in text nodes."
},
"children": {
"type": "array",
"description": "List of elements children",
"items": { "$ref": "#" }
},
"attributes": {
"type": "object",
"description": "Attributes for the element"
}
}
}
I think I'll add something like this in the Readme.
However you could transform that output through transformNode
like here where name
is transformed into name
and attributes
into props
as well as removing children
property in case the Array
is emapty.
Please let me know your use case / needs so I can understand if could be useful to add something related.
from svgson.
First, I was wondering what are the possible values for the type
property. I see element
, but didn't know if other options would be fragment
or text
.
Second, I was also looking for a json format for some svg tools, so I also might adopt the same format you have 🤓.
Thirdly - it might make sense to make the serialize
function a standalone project? That way other tools based on the format do not need the parse
code. Just a thought 🤷♂️
from svgson.
First, I was wondering what are the possible values for the type property…
Values for type could be element
or text
Second, I was also looking for a json format for some svg tools…
Super curious about those tools! 🤓
Thirdly - it might make sense to make the serialize function a standalone project?
You mean the stringify one? Could absolutely make sense. The thing I am thinking is that svgson@^3
it should be tree shakable and you could import like
const { stringify } = require('svgson')
from svgson.
Also, I am using TypeScript. So, I will also be doing a conversion from from JSON schema to TypeScript interface.
I may use it in https://github.com/Microsoft/maker.js
My current build is not es6 based, so I will not be using tree shaking for a while.
from svgson.
Also, I am using TypeScript
So you think is necessary to have ths Schema or it's enough what showed before?
I may use it in https://github.com/Microsoft/maker.js
Awesome, I started playing with maker.js
trying to switch this library in something more accurate but (at least what I tried) didn't work for me. If you are interested in another thread/issue I can expose the idea, needs, etc.
My current build is not es6 based, so I will not be using tree shaking for a while.
Right, so you think could work something like svgson-stringify
module? The only thing I am thinking in case remains also inside svgson
package, the maintenance part.
from svgson.
I can use what you've already shared. I thought having a formal schema might also be an easy way to fully document it :)
Please open an issue on Maker.js - would love to know what didn't work for you. 👍
Yes, svgson-stringify
could be cool, but don't want to add a maintenance burden.
from svgson.
I thought having a formal schema might also be an easy way to fully document it
Will go with this to update the documentation.
Please open an issue on Maker.js
sure I will, however I think there isn't an issue directly related on maker.js
, more on my approach.
from svgson.
Sorry to piggyback on this thread. I couldn't find anyplace else to ask a question. This looks really useful to me. I am a bit new to coding. I am working on a google polymer based app. I think in order to use this I would need to turn this into a web component. Is that something that a novice like me might be able to tackle?
from svgson.
hi @jmeurer986 it's ok to ask questions as an issue here, if this will become a large thread maybe better to open a new one. I think you could create an svgson
web-component without problem.
from svgson.
Related Issues (20)
- _svgson.default.parse is not a function HOT 2
- --title in master branch HOT 2
- html entity amp; being inserted into urls? HOT 4
- svgson is not a function HOT 1
- Consider using ^ or ~ versions in package.json HOT 2
- Set required version of `svgo` as at least 1.3.2 HOT 2
- stringify:: Having & symbol rendered in text? HOT 2
- main source file HOT 1
- import files from src folder HOT 3
- Keep default values HOT 3
- Querying with selectors? HOT 3
- Why is svgson an async function? HOT 2
- Bump svgo to latest version? HOT 4
- Is repo still active? HOT 5
- Remove omit-deep dep? HOT 1
- version 5.2.1 on npm? HOT 1
- Special characters generate weird CDATA tag? HOT 4
- How to convert JSON to SVG? HOT 2
- Document new stringify features
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 svgson.