From c2d0c71de5b7f2e7b9d17bac36ace71950e6b09d Mon Sep 17 00:00:00 2001 From: Chris L Date: Sat, 26 Nov 2016 00:21:46 +0100 Subject: [PATCH 1/2] Added postCSS functionality * empty postcss config file * postcss dependencies * webpack config --- conf/webpack/Base.js | 68 ++++++++++++++++++++++++++++---------------- conf/webpack/Test.js | 6 +++- package.json | 2 ++ postcss.config.js | 3 ++ 4 files changed, 54 insertions(+), 25 deletions(-) create mode 100644 postcss.config.js diff --git a/conf/webpack/Base.js b/conf/webpack/Base.js index e5c515e..7002a83 100644 --- a/conf/webpack/Base.js +++ b/conf/webpack/Base.js @@ -99,22 +99,30 @@ class WebpackBaseConfig { presets: ['es2015'] } }, + { + test: /\.(png|jpg|gif|mp4|ogg|svg|woff|woff2)$/, + loader: 'file-loader' + }, { test: /^.((?!cssmodule).)*\.css$/, loaders: [ { loader: 'style-loader' }, - { loader: 'css-loader' } + { + loader: 'css-loader', + query: { importLoaders: 1 } + }, + { loader: 'postcss-loader' } ] }, - { - test: /\.(png|jpg|gif|mp4|ogg|svg|woff|woff2)$/, - loader: 'file-loader' - }, { test: /^.((?!cssmodule).)*\.(sass|scss)$/, loaders: [ { loader: 'style-loader' }, - { loader: 'css-loader' }, + { + loader: 'css-loader', + query: { importLoaders: 1 } + }, + { loader: 'postcss-loader' }, { loader: 'sass-loader' } ] }, @@ -122,7 +130,11 @@ class WebpackBaseConfig { test: /^.((?!cssmodule).)*\.less$/, loaders: [ { loader: 'style-loader' }, - { loader: 'css-loader' }, + { + loader: 'css-loader', + query: { importLoaders: 1 } + }, + { loader: 'postcss-loader' }, { loader: 'less-loader' } ] }, @@ -130,25 +142,14 @@ class WebpackBaseConfig { test: /^.((?!cssmodule).)*\.styl$/, loaders: [ { loader: 'style-loader' }, - { loader: 'css-loader' }, + { + loader: 'css-loader', + query: { importLoaders: 1 } + }, + { loader: 'postcss-loader' }, { loader: 'stylus-loader' } ] }, - { - test: /\.json$/, - loader: 'json-loader' - }, - { - test: /\.(js|jsx)$/, - include: [].concat( - this.includedPackages, - [this.srcPathAbsolute] - ), - loaders: [ - // Note: Moved this to .babelrc - { loader: 'babel-loader' } - ] - }, { test: /\.cssmodule\.(sass|scss)$/, loaders: [ @@ -157,6 +158,7 @@ class WebpackBaseConfig { loader: 'css-loader', query: cssModulesQuery }, + { loader: 'postcss-loader' }, { loader: 'sass-loader' } ] }, @@ -167,7 +169,8 @@ class WebpackBaseConfig { { loader: 'css-loader', query: cssModulesQuery - } + }, + { loader: 'postcss-loader' } ] }, { @@ -178,6 +181,7 @@ class WebpackBaseConfig { loader: 'css-loader', query: cssModulesQuery }, + { loader: 'postcss-loader' }, { loader: 'less-loader' } ] }, @@ -189,8 +193,24 @@ class WebpackBaseConfig { loader: 'css-loader', query: cssModulesQuery }, + { loader: 'postcss-loader' }, { loader: 'stylus-loader' } ] + }, + { + test: /\.json$/, + loader: 'json-loader' + }, + { + test: /\.(js|jsx)$/, + include: [].concat( + this.includedPackages, + [this.srcPathAbsolute] + ), + loaders: [ + // Note: Moved this to .babelrc + { loader: 'babel-loader' } + ] } ] }, diff --git a/conf/webpack/Test.js b/conf/webpack/Test.js index 93a6b3f..afdae54 100644 --- a/conf/webpack/Test.js +++ b/conf/webpack/Test.js @@ -37,7 +37,8 @@ class WebpackTestConfig extends WebpackBaseConfig { { loader: 'css-loader', query: cssModulesQuery - } + }, + { loader: 'postcss-loader' } ] }, { @@ -48,6 +49,7 @@ class WebpackTestConfig extends WebpackBaseConfig { loader: 'css-loader', query: cssModulesQuery }, + { loader: 'postcss-loader' }, { loader: 'less-loader' } ] }, @@ -59,6 +61,7 @@ class WebpackTestConfig extends WebpackBaseConfig { loader: 'css-loader', query: cssModulesQuery }, + { loader: 'postcss-loader' }, { loader: 'stylus-loader' } ] }, @@ -70,6 +73,7 @@ class WebpackTestConfig extends WebpackBaseConfig { loader: 'css-loader', query: cssModulesQuery }, + { loader: 'postcss-loader' }, { loader: 'sass-loader' } ] }, diff --git a/package.json b/package.json index 50e53a5..0a19ce8 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,8 @@ "mocha": "^3.0.0", "null-loader": "^0.1.1", "phantomjs-prebuilt": "^2.1.7", + "postcss": "^5.2.6", + "postcss-loader": "^1.1.1", "react-addons-test-utils": "^15.0.1", "rimraf": "^2.5.2", "sinon": "^1.17.3", diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..fe23259 --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,3 @@ +module.exports = () => ({ + plugins: [] +}); From 58d1161341467c4ec345806c99eff2a5b7de6877 Mon Sep 17 00:00:00 2001 From: Chris L Date: Sat, 17 Dec 2016 14:01:53 +0100 Subject: [PATCH 2/2] Removed postcss dependencies, since they are handled by the generator --- package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/package.json b/package.json index 0a19ce8..50e53a5 100644 --- a/package.json +++ b/package.json @@ -72,8 +72,6 @@ "mocha": "^3.0.0", "null-loader": "^0.1.1", "phantomjs-prebuilt": "^2.1.7", - "postcss": "^5.2.6", - "postcss-loader": "^1.1.1", "react-addons-test-utils": "^15.0.1", "rimraf": "^2.5.2", "sinon": "^1.17.3",