Skip to content

Commit

Permalink
Upgrade css deps (#6455)
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense authored and KyleAMathews committed Jul 15, 2018
1 parent 57301e8 commit 64fbb8e
Show file tree
Hide file tree
Showing 4 changed files with 466 additions and 323 deletions.
7 changes: 4 additions & 3 deletions packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@babel/runtime": "7.0.0-beta.51",
"@babel/traverse": "7.0.0-beta.51",
"async": "^2.1.2",
"autoprefixer": "^7.1.2",
"autoprefixer": "^8.6.5",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^8.2.2",
"babel-loader": "8.0.0-beta.0",
Expand All @@ -38,7 +38,8 @@
"convert-hrtime": "^2.0.0",
"copyfiles": "^1.2.0",
"core-js": "^2.5.0",
"css-loader": "^0.28.11",
"css-loader": "^1.0.0",
"cssnano": "^4.0.2",
"debug": "^3.1.0",
"del": "^3.0.0",
"detect-port": "^1.2.1",
Expand Down Expand Up @@ -120,7 +121,7 @@
"slash": "^1.0.0",
"socket.io": "^2.0.3",
"string-similarity": "^1.2.0",
"style-loader": "^0.19.1",
"style-loader": "^0.21.0",
"treeify": "^1.1.0",
"type-of": "^2.0.1",
"uglifyjs-webpack-plugin": "^1.2.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/src/utils/babel-parse-to-ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const PARSER_OPTIONS = {
],
}

export function getBabelParserOptions(filePath) {
export function getBabelParserOptions(filePath: string) {
// Flow and typescript plugins can't be enabled simultaneously
if (/\.tsx?/.test(filePath)) {
const { plugins } = PARSER_OPTIONS
Expand All @@ -47,6 +47,6 @@ export function getBabelParserOptions(filePath) {
return PARSER_OPTIONS
}

export function babelParseToAst(contents, filePath) {
export function babelParseToAst(contents: string, filePath: string) {
return parser.parse(contents, getBabelParserOptions(filePath))
}
12 changes: 10 additions & 2 deletions packages/gatsby/src/utils/webpack-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export type LoaderUtils = {
postcss: LoaderResolver<{
browsers?: string[],
plugins?: Array<any> | ((loader: any) => Array<any>),
minimze?: boolean,
cssnano?: any,
}>,

file: LoaderResolver<*>,
Expand Down Expand Up @@ -195,7 +197,6 @@ module.exports = async ({
? require.resolve(`css-loader/locals`)
: require.resolve(`css-loader`),
options: {
minimize: PRODUCTION,
sourceMap: !PRODUCTION,
camelCase: `dashesOnly`,
// https://github.com/webpack-contrib/css-loader/issues/406
Expand All @@ -206,7 +207,13 @@ module.exports = async ({
},

postcss: (options = {}) => {
let { plugins, browsers = supportedBrowsers, ...postcssOpts } = options
let {
cssnano,
plugins,
browsers = supportedBrowsers,
minimze = PRODUCTION,
...postcssOpts
} = options

return {
loader: require.resolve(`postcss-loader`),
Expand All @@ -218,6 +225,7 @@ module.exports = async ({
(typeof plugins === `function` ? plugins(loader) : plugins) || []

return [
minimze && require(`cssnano`)(cssnano),
flexbugs,
autoprefixer({ browsers, flexbox: `no-2009` }),
...plugins,
Expand Down
Loading

0 comments on commit 64fbb8e

Please sign in to comment.