Fyrd / caniuse

Raw browser/feature support data from caniuse.com

Home Page:https://caniuse.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Smaller data for client-side builds

ai opened this issue · comments

Some React guys think about using Autoprefixes in client side. It is not a best solution, but will be good for universal/isomorphic JS, when we need to prerender SPA on server-side and didn’t know about browser.

An main problem of using Autoprefixer on client side is Can I Use dump size. And the main problem is that we need only few subset on this data.

So it will be very useful if we have minimized version of data. Like caniuse-db/support-json/css-animation.json:

{
  "ie": {
    "5.5 9": "n",
    "10 11": "y"
  }
  
}

I use space between versions, because - is already used in some versions names.

/cc @Fyrd

@Fyrd this task is very important for Autoprefixer, so tell if you need any help

@ai I don't see why this isn't something Autoprefixer couldn't generate itself? You'd know better what the ideal minimized format would look like for your purposes so I'm not sure why it would need to happen in the caniuse repo.

Yeap, the other solution is to have some “middleware” npm package, which will compress Can I Use data.

But this “middleware” will be a lack for actual data. We need a Can I Use release first, then I need to run compress scripts and release my npm package.

In previous versions Autoprefixer has own data copy, but in practice it was not good soluion :(.

Autoprefixer can’t compress Can I Use data on-the-fly, because problem is with Browserify/webpack, which will add to bundle all require files.

While I understand it would make things more convenient to do this at the caniuse level, I don't think it's a good idea to start building custom data files just to make things easier for any given project that uses the data. If I started doing this for autoprefixer other projects might also start making similar requests and it would become very hard to maintain things.

So I feel it's best to have the data the way it is, same for everyone, and let individual projects find their own ways to process it in whatever way meets their needs.