Generate from string
evilPaprika opened this issue ยท 4 comments
evilPaprika commented
Is it possible to generate regex passing browserlist as a string(or object)? Using browserlistrc file not always convenient or suitable. ๐
dangreen commented
@evilPaprika Hi!
Yes, you can.
https://github.com/browserslist/browserslist-useragent-regexp#cli
for example:
yarn exec -- browserslist-useragent-regexp "defaults, unreleased versions"
evilPaprika commented
@dangreen
Well, I meant in javascript, not as cli utility.
I apologize for not being clear. ๐ฑ
I actually want to avoid using supportedBrowsers.js
file and .browserlistrc
altogether.
dangreen commented
https://github.com/browserslist/browserslist-useragent-regexp#options
getUserAgentRegExp(options)
method accepts browsers
option
getUserAgentRegExp({
browsers: "defaults, unreleased versions",
allowHigherVersions: true,
allowZeroSubversions: true
})
evilPaprika commented
omg thank you so much! ๐
exactly what I need!