Closed cvn closed 10 years ago
i've considered adding options, hadn't implemented it yet though. curious though, which option are you looking to pass?
I'm looking to pass target browsers, like in the example above. I believe these are the only options autoprefixer accepts.
oh yeah sorry, i just meant whats the browser support you are trying to achieve? and for what reason? :) just trying to understand the use case to see if there's a good way to handle it with an abstraction
This is what I currently use: 'last 2 versions', 'ff 15', 'ios 3.2', 'android 2.3', 'ie 8'
Mostly this gives me more old -moz and -webkit properties, and enables support on older gear (older iOS and Android devices, old builds of firefox bundled with CentOS, etc). Since autoprefixer makes maintaining these additional prefixes more or less free, I figure why not.
yeah, that's something we (twitter) wanted and provided for in rework-suit. pretty handy, especially if you need a more explicit support matrix that the autoprefixer defaults.
yeah might not be able to get out of it then. it definitely makes sense. i just wish the abbreviations for browser names were expanded. i think thats the part that makes me think the api is ugly and makes me want to avoid it
k im thinking the api would be:
myth(css, {
browsers: []
});
since that leaves us open for stuff like:
myth(css, {
browsers: [],
compress: true
});
and the rework exposed function could even take the same ones too:
myth({
browsers: [],
compress: true
});
+1 to this feature, if want to generate my css files only for modern browsers i might don't want calc()
expression to be generated as a plain amount in px
@basiclines this issue doesn't affect calc()
translation. This is specifically for autoprefixer, which only controls vendor prefixes, e.g. -webkit-
, -moz-
, etc.
Another +1. Here's my use case: When I use "display: flex", I do not want "display: -webkit-box" added. -webkit-box applies on iOS 6 Safari and older, however, in my case, it just makes things worse because it doesn't implement any form of flex-wrap. I'd rather just not have it at all.
@ianstormtaylor Expanded browser names are now supported by Autoprefixer, not sure if that changes your opinion of the API.
FYI, adobe resin (also based on rework) allows to pass browsers
option while calling the function
https://github.com/topcoat/resin
output = resin({
// Pass it a css file to process
src: 'src/entry.css',
// Tell it what browsers to prefix for
browsers: ['last 1 version', 'ios', 'android 4']
});
write('path/to/output/dir/filename.css', output);
compare to myth
var css = fs.readFileSync('index.css', 'utf8');
var output = myth(css);
fs.writeFileSync('converted.css', output);
I'd prefer resin-like API instead of
myth(css, {
browsers: [],
compress: true
});
added in 1.0.0
! thanks
Is there a way to pass options to autoprefixer? I don't see it in the docs. Autoprefixer accepts arguments like so: