Skip to content

Commit

Permalink
build(config): respect browserslist config
Browse files Browse the repository at this point in the history
Currently gulp-autoprefixer has forced settings via overrideBrowserslist, however it's not recommended and breaks best practices as it silently overrides user's settings. As user's settings in package.json for example are not respected there will be useless CSS properties for modern browsers, for example existing config includes even IE 10
  • Loading branch information
layershifter authored and lubber-de committed Jan 25, 2020
1 parent 8ab6b89 commit fdd3cc8
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tasks/config/tasks.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
var
browserslist = require('browserslist'),
console = require('better-console'),
config = require('./user'),
release = require('./project/release')
;

var defaultBrowsers = browserslist(browserslist.defaults)
var userBrowsers = browserslist()
var hasBrowserslistConfig = JSON.stringify(defaultBrowsers) !== JSON.stringify(userBrowsers)

var overrideBrowserslist = hasBrowserslistConfig ? undefined : [
'last 2 versions',
'> 1%',
'opera 12.1',
'bb 10',
'android 4'
]

module.exports = {

Expand Down Expand Up @@ -118,13 +130,7 @@ module.exports = {

/* What Browsers to Prefix */
prefix: {
overrideBrowserslist: [
'last 2 versions',
'> 1%',
'opera 12.1',
'bb 10',
'android 4'
]
overrideBrowserslist
},

/* File Renames */
Expand Down

0 comments on commit fdd3cc8

Please sign in to comment.