From fdd3cc8c36670dee059dabdd0045edd40b8685f4 Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Sat, 25 Jan 2020 19:34:54 +0100 Subject: [PATCH] build(config): respect browserslist config 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 --- tasks/config/tasks.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tasks/config/tasks.js b/tasks/config/tasks.js index 2ebf1d872d..3e33556312 100644 --- a/tasks/config/tasks.js +++ b/tasks/config/tasks.js @@ -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 = { @@ -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 */