segmentio / myth

A CSS preprocessor that acts like a polyfill for future versions of the spec.
4.32k stars 131 forks source link

Automation of enabling/disabling features like autoprefixer #94

Open MoOx opened 10 years ago

MoOx commented 10 years ago

Like autoprefixer we could use caniuse-db with a list of browsers to know what features to use or not. This is not essential now, but it will became when browser start to implement all features we got here.

myth --browsers="last 1 version, > 1%, Explorer 7" input.css output.css
var converted = myth(css, {browsers: ["last 1 version", "> 1%", "Explorer 7"})

We need to check @ai works :)

ianstormtaylor commented 10 years ago

Would be nice to ideate a bit on the syntax to make it cleaner feeling, since things like 'last 1 version' aren't grammatically correct

MoOx commented 10 years ago

Indeed. latest version should easily replace lastest 1 version :)

MoOx commented 10 years ago

@ianstormtaylor You don't like "Internet Explorer" being transformed to "Explorer" right ?

ai commented 10 years ago

@ianstormtaylor we can fix grammar issues in Autoprefixer too to have common API.

ai commented 10 years ago

@MoOx Issue is only in latest version?

MoOx commented 10 years ago

We should definitly make a common module to ask caniuse-db for a reponse.

MoOx commented 10 years ago

@ai not sure, we should check all possibilities you have :)

ai commented 10 years ago

@MoOx yeap, common module will be nice.

But there is one problem. last 2 versions select not all browsers, because there are a lot of minor browsers. It is OK for Autoprefixer, but bad for common module. Maybe last 2 versions of popular?

ai commented 10 years ago

BTW, there are also awesome Autopolyfiller, which need browser selection too. /cc @azproduction

MoOx commented 10 years ago

What about including request feature directly to caniuse-db ?

ai commented 10 years ago

@MoOx now caniuse-db is just database. Maybe separated module will be better. caniuse-browsers?

MoOx commented 10 years ago

caniuse will do the trick (since it's a question: "can I use X on [Y]"). Maybe we can contact the maintainer of https://www.npmjs.org/package/caniuse to see if we can get it ?

ai commented 10 years ago

/cc @Fyrd

MoOx commented 10 years ago

I've contacted @wuchengwei to see if we can get the npm name :)

azproduction commented 10 years ago

@ai as far as I know, there is no data in caniuse about ES features and their quality. However, I think it is possible to mix @kangax tables with caniuse to create an awesome features db!

ai commented 10 years ago

@azproduction I remember, that you ask for some separated browser selector, for quieries like last 2 versions. What you uses now?