Comments (8)
@tristen: I have never created or exported SVGs myself, so I'd love help figuring out and documenting this stuff.
from batfish.
Just documentation on what the SVG should look like (i.e exported with inline styles and as few paths as possible?). I've used it on SVGs exported from Inkscape and it didn't go well.
from batfish.
The only two rules that I think need to be enforced are:
- React only supports these SVG attributes: https://facebook.github.io/react/docs/dom-elements.html#all-supported-svg-attributes
- Inline styles only, no
<style>
element
Also important to note that height / width properties will be ignored by batfish. Maybe we should output a warning message in cases where this happens?
from batfish.
I'm thinking that this tool for converting SVGs to optimized React components should be an independent open-source project. We should see if a suitable one already exists (I assume I did this before and didn't find any?), and if not let's create and publish it. Seems to me pretty useful for React devs.
from batfish.
This seems similar: https://github.com/boopathi/react-svg-loader, but our system has some weird quirks wrt logo recoloring.
from batfish.
react-svg-loader looks great! I don't remember why I didn't use it before, and instead wrote some code "inspired" by it 🙄. We should try it again.
from batfish.
Ugh, I've looked through a confusing batch of open-source SVG-to-JSX things. All of them seem partially if not wholly abandoned? Very hard to judge. I've sent out a feeler to see how active react-svg-loader is. If it seems to be stalled, seems we'll want to write out own thing.
from batfish.
I made:
- https://github.com/mapbox/svg-react-transformer
- https://github.com/mapbox/svg-react-transformer-writer
- https://github.com/mapbox/svg-react-transformer-loader
I'm actually thinking maybe none of them should be included in Batfish proper — but should be suggested as recommendations, and included in the mapbox-batfish wrapper with more defaults.
from batfish.
Related Issues (20)
- How to use "browser" package.json field in static (Node) build? HOT 2
- Replace live-server with browser-sync HOT 6
- Delete from output directory files that are not relics of the build HOT 1
- iOS Browser Issues HOT 1
- Trailing spaces causing markdown formatting issues HOT 4
- Incorrect validation error with `uglify: false` on `inlineJs` object
- prefixUrlAbsolute is hard to use with pathnames that include siteBasePath HOT 1
- JSON files aren't added to outputDirectory in v1.9.7 HOT 1
- heap out of memory error on Linux
- "batfish build" freezes on "Processing files for static HTML" stage HOT 1
- Replace Autoprefixer browsers option to Browserslist config HOT 2
- Could we check if a hash link is on current page before routing?
- JavaScript heap out of memory HOT 1
- Processing files for static HTML is killed HOT 2
- Upgrade to Node 10
- v2 breaks in watch mode
- Make the site URL color more legible
- Identifier 'X' has already been declared
- Network port automatically selected not shown in console messages
- Doesn't support import assertions.
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 batfish.