-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
browser compatible #633
browser compatible #633
Conversation
caub
commented
Dec 13, 2016
•
edited
Loading
edited
- browser bundle
- promise api:
4ac32bc
to
96ffdf8
Compare
4192905
to
1aac3ec
Compare
aeeda0a
to
16867e1
Compare
added below a commit to round viewBox to floatPrecision too, simplified removeViewBox plugin, I can make it a separate PR later when more time Also we should use this to Math.round to round values: var p=3; console.time(1); var factor=Math.pow(10,p); for(var i=0;i<1e6;i++){ var x=Math.random(); Math.round(x*factor)/factor } console.timeEnd(1);
var p=3, re=/0+$/; console.time(2); for(var i=0;i<1e6;i++){ var x=Math.random(); x.toFixed(p).replace(re, '') } console.timeEnd(2); it's faster than toFixed, and I can't think of a reason to keep trailing zeros? (2.30 instead of 2.3) |
546c58f
to
2ccd1b6
Compare
I'm afraid it's too much change to accept. I don't want to stick to webpack or any compiler to keep code base as simple, compact and effective as possible. Lazy plugins requiring, when plugins are loaded only when needed, also follows this goal. Unfortunately, I don't know a graceful way to make it compatible with non-Node.js environment. Hopefully, there'll be a solution in future like new module system. |
Do you accept if I clean it? this PR was really dirty For webpack, I don't especially love it myself too, but I'm sure many users would benefit if SVGO can run in browser without effort, I need it for work, like https://github.com/jakearchibald/svgomg too. Would it be ok? and thanks for all the hard work Will do, in hope |