From d3919b182103005c72462260c5f5f76b5253e456 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Tue, 22 Sep 2020 15:23:04 +0200 Subject: [PATCH] Fix PostCSS not applying any plugins --- gulpfile.js | 43 ++++++++++++++++++++++++------------------- package.json | 2 +- postcss.config.js | 35 ----------------------------------- yarn.lock | 39 +++++++++++++++++++-------------------- 4 files changed, 44 insertions(+), 75 deletions(-) delete mode 100644 postcss.config.js diff --git a/gulpfile.js b/gulpfile.js index 54948c7..eba5804 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -45,26 +45,31 @@ async function js() { } async function css() { + const plugins = [ + mixins({ + mixins: { + networks, + }, + }), + cssVariables, + calc, + ]; + + if (!isDev) { + plugins.push( + cssnano({ + preset: 'default', + }), + autoprefixer(), + banner({ + banner: bannerText, + important: true, + }), + ); + } + gulp.src(path.resolve(__dirname, 'src', 'style.css')) - .pipe(postcss({ - plugins: [ - mixins({ - mixins: { - networks, - }, - }), - cssVariables, - calc, - (!isDev) && cssnano({ - preset: 'default', - }), - autoprefixer, - banner({ - banner: bannerText, - important: true, - }), - ], - })) + .pipe(postcss(plugins)) .pipe(rename({ basename: pkg.name, extname: isDev ? '.css' : '.min.css', diff --git a/package.json b/package.json index f670361..c1a0251 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@rollup/plugin-strip": "^2.0.0", "@rollup/plugin-typescript": "^5.0.2", "@size-limit/preset-small-lib": "^4.5.5", - "autoprefixer": "^10.0.0", + "autoprefixer": "^9.8.6", "browserslist": "^4.14.3", "cross-env": "^7.0.2", "cssnano": "^4.1.10", diff --git a/postcss.config.js b/postcss.config.js deleted file mode 100644 index 7578715..0000000 --- a/postcss.config.js +++ /dev/null @@ -1,35 +0,0 @@ -/* eslint-disable import/no-extraneous-dependencies */ -/* eslint-disable import/order */ -/* eslint-disable global-require */ - -const pkg = require('./package.json'); - -const isDev = process.env.ROLLUP_WATCH || process.env.NODE_ENV === 'development'; -const bannerText = `${pkg.name} v${pkg.version} by Nikita Karamov\n${pkg.homepage}`; - -const plugins = [ - require('postcss-mixins')({ - mixins: { - networks: require('./src/networksMixin'), - }, - }), - require('postcss-css-variables'), - require('postcss-calc'), -]; - -if (!isDev) { - plugins.push( - require('cssnano')({ - preset: 'default', - }), - require('autoprefixer'), - require('postcss-banner')({ - banner: bannerText, - important: true, - }), - ); -} - -module.exports = { - plugins, -}; diff --git a/yarn.lock b/yarn.lock index 2645cce..0b21902 100644 --- a/yarn.lock +++ b/yarn.lock @@ -789,16 +789,17 @@ atob@^2.1.2: resolved "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -autoprefixer@^10.0.0: - version "10.0.0" - resolved "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.0.0.tgz#4afbe9eb902ffb5d7a9ef6d36013948fdb34601f" - integrity sha512-rFlVYthz6Iw0LhEYryiGGyjTGofebWie3ydvtqTCJiwWe+z6y8H35b4cadYbOUcYlP495TNeVktW+ZZqxbPW4Q== +autoprefixer@^9.8.6: + version "9.8.6" + resolved "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.8.6.tgz#3b73594ca1bf9266320c5acf1588d74dea74210f" + integrity sha512-XrvP4VVHdRBCdX1S3WXVD8+RyG9qeb1D5Sn1DeLiG2xfSpzellk5k54xbUERJ3M5DggQxes39UGOTP8CFrEGbg== dependencies: - browserslist "^4.14.2" - caniuse-lite "^1.0.30001131" + browserslist "^4.12.0" + caniuse-lite "^1.0.30001109" colorette "^1.2.1" normalize-range "^0.1.2" num2fraction "^1.2.2" + postcss "^7.0.32" postcss-value-parser "^4.1.0" bach@^1.0.0: @@ -1018,7 +1019,7 @@ browserify-zlib@^0.2.0: dependencies: pako "~1.0.5" -browserslist@^4.0.0, browserslist@^4.14.2, browserslist@^4.14.3: +browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.14.3: version "4.14.3" resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.14.3.tgz#381f9e7f13794b2eb17e1761b4f118e8ae665a53" integrity sha512-GcZPC5+YqyPO4SFnz48/B0YaCwS47Q9iPChRGi6t7HhflKBcINzFrJvRfC+jp30sRMKxF+d4EHGs27Z0XP1NaQ== @@ -1213,11 +1214,16 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001131: +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001131: version "1.0.30001131" resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001131.tgz" integrity sha512-4QYi6Mal4MMfQMSqGIRPGbKIbZygeN83QsWq1ixpUwvtfgAZot5BrCKzGygvZaV+CnELdTwD0S4cqUNozq7/Cw== +caniuse-lite@^1.0.30001109: + version "1.0.30001135" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001135.tgz#995b1eb94404a3c9a0d7600c113c9bb27f2cd8aa" + integrity sha512-ziNcheTGTHlu9g34EVoHQdIu5g4foc8EsxMGC7Xkokmvw0dqNtX8BS8RgCgFBaAiSp2IdjvBxNdh0ssib28eVQ== + chalk@^1.0.0, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -1984,7 +1990,7 @@ defer-to-connect@^2.0.0: resolved "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.0.tgz#83d6b199db041593ac84d781b5222308ccf4c2c1" integrity sha512-bYL2d05vOSf1JEZNx5vSAtPuBMkX8K9EUutg7zlKvTqKXHt7RhWJFbmd7qakVuf13i+IkGmp6FwSsONOf6VYIg== -define-properties@^1.1.2, define-properties@^1.1.3: +define-properties@^1.1.3: version "1.1.3" resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== @@ -2164,7 +2170,7 @@ ejs@^2.6.1: resolved "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz#48661287573dcc53e366c7a1ae52c3a120eec9ba" integrity sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA== -electron-to-chromium@^1.3.380, electron-to-chromium@^1.3.570: +electron-to-chromium@^1.3.570: version "1.3.570" resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.570.tgz#3f5141cc39b4e3892a276b4889980dabf1d29c7f" integrity sha512-Y6OCoVQgFQBP5py6A/06+yWxUZHDlNr/gNDGatjH8AZqXl8X0tE4LfjLJsXGz/JmWJz8a6K7bR1k+QzZ+k//fg== @@ -3285,7 +3291,7 @@ has-flag@^4.0.0: resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -has-symbols@^1.0.0, has-symbols@^1.0.1: +has-symbols@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== @@ -4846,7 +4852,7 @@ node-libs-browser@^2.2.1: util "^0.11.0" vm-browserify "^1.0.1" -node-releases@^1.1.52, node-releases@^1.1.61: +node-releases@^1.1.61: version "1.1.61" resolved "https://registry.npmjs.org/node-releases/-/node-releases-1.1.61.tgz#707b0fca9ce4e11783612ba4a2fcba09047af16e" integrity sha512-DD5vebQLg8jLCOzwupn954fbIiZht05DAZs0k2u8NStSe6h9XdsuIQL8hSRKYiU8WUQRznmSDrKGbv3ObOmC7g== @@ -5009,7 +5015,7 @@ object-inspect@^1.7.0, object-inspect@^1.8.0: resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz#df807e5ecf53a609cc6bfe93eac3cc7be5b3a9d0" integrity sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA== -object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: +object-keys@^1.0.12, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== @@ -5574,13 +5580,6 @@ pkg-dir@^4.1.0: dependencies: find-up "^4.0.0" -pkg-up@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-3.1.0.tgz#100ec235cc150e4fd42519412596a28512a0def5" - integrity sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA== - dependencies: - find-up "^3.0.0" - plugin-error@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz#77016bd8919d0ac377fdcdd0322328953ca5781c"