|
| 1 | +// const ExtractTextPlugin = require(`extract-text-webpack-plugin`); |
| 2 | +// const { cssModulesConfig } = require(`gatsby-1-config-css-modules`); |
| 3 | + |
| 4 | +// exports.modifyWebpackConfig = ({ config, stage }, options) => { |
| 5 | +// // Pass in plugins regardless of stage. |
| 6 | +// // If none specified, fallback to Gatsby default postcss plugins. |
| 7 | +// if (options.postCssPlugins) { |
| 8 | +// config.merge(current => { |
| 9 | +// current.postcss = options.postCssPlugins; |
| 10 | +// return current; |
| 11 | +// }); |
| 12 | +// } |
| 13 | + |
| 14 | +// const sassFiles = /\.css$/; |
| 15 | +// const sassModulesFiles = /\.module\.css$/; |
| 16 | + |
| 17 | +// switch (stage) { |
| 18 | +// case `develop`: { |
| 19 | +// config.loader(`sass`, { |
| 20 | +// test: sassFiles, |
| 21 | +// exclude: sassModulesFiles, |
| 22 | +// loaders: [`style`, `postcss`] |
| 23 | +// }); |
| 24 | + |
| 25 | +// config.loader(`sassModules`, { |
| 26 | +// test: sassModulesFiles, |
| 27 | +// loaders: [`style`, cssModulesConfig(stage), `postcss`] |
| 28 | +// }); |
| 29 | +// return config; |
| 30 | +// } |
| 31 | +// case `build-css`: { |
| 32 | +// config.loader(`sass`, { |
| 33 | +// test: sassFiles, |
| 34 | +// exclude: sassModulesFiles, |
| 35 | +// loader: ExtractTextPlugin.extract([`css?minimize`, `postcss`]) |
| 36 | +// }); |
| 37 | + |
| 38 | +// config.loader(`sassModules`, { |
| 39 | +// test: sassModulesFiles, |
| 40 | +// loader: ExtractTextPlugin.extract(`style`, [ |
| 41 | +// cssModulesConfig(stage), |
| 42 | +// `postcss` |
| 43 | +// ]) |
| 44 | +// }); |
| 45 | +// return config; |
| 46 | +// } |
| 47 | +// case `develop-html`: |
| 48 | +// case `build-html`: { |
| 49 | +// config.loader(`sass`, { |
| 50 | +// test: sassFiles, |
| 51 | +// exclude: sassModulesFiles, |
| 52 | +// loader: `null` |
| 53 | +// }); |
| 54 | + |
| 55 | +// config.loader(`sassModules`, { |
| 56 | +// test: sassModulesFiles, |
| 57 | +// loader: ExtractTextPlugin.extract(`style`, [ |
| 58 | +// cssModulesConfig(stage), |
| 59 | +// `postcss` |
| 60 | +// ]) |
| 61 | +// }); |
| 62 | +// return config; |
| 63 | +// } |
| 64 | +// case `build-javascript`: { |
| 65 | +// config.loader(`sass`, { |
| 66 | +// test: sassFiles, |
| 67 | +// exclude: sassModulesFiles, |
| 68 | +// loader: `null` |
| 69 | +// }); |
| 70 | + |
| 71 | +// config.loader(`sassModules`, { |
| 72 | +// test: sassModulesFiles, |
| 73 | +// loader: ExtractTextPlugin.extract(`style`, [cssModulesConfig(stage)]) |
| 74 | +// }); |
| 75 | +// return config; |
| 76 | +// } |
| 77 | +// default: { |
| 78 | +// return config; |
| 79 | +// } |
| 80 | +// } |
| 81 | +// }; |
0 commit comments