diff --git a/packages/gatsby-plugin-sass/src/__tests__/gatsby-node.js b/packages/gatsby-plugin-sass/src/__tests__/gatsby-node.js index ef75114d919b0..7f96d5a1fad3e 100644 --- a/packages/gatsby-plugin-sass/src/__tests__/gatsby-node.js +++ b/packages/gatsby-plugin-sass/src/__tests__/gatsby-node.js @@ -61,6 +61,7 @@ describe(`pluginOptionsSchema`, () => { it(`should provide meaningful errors when fields are invalid`, async () => { const expectedErrors = [ `"implementation" must be of type object`, + `"cssLoaderOptions" must be of type object`, `"postCssPlugins" must be an array`, `"sassRuleTest" must be of type object`, `"sassRuleModulesTest" must be of type object`, @@ -88,6 +89,7 @@ describe(`pluginOptionsSchema`, () => { const { errors } = await testPluginOptionsSchema(pluginOptionsSchema, { implementation: `This should be a require() thing`, postCssPlugins: `This should be an array of postCss plugins`, + cssLoaderOptions: `This should be an object of css-loader options`, sassRuleTest: `This should be a regexp`, sassRuleModulesTest: `This should be a regexp`, useResolveUrlLoader: `This should be a boolean`, @@ -117,6 +119,7 @@ describe(`pluginOptionsSchema`, () => { it(`should validate the schema`, async () => { const { isValid } = await testPluginOptionsSchema(pluginOptionsSchema, { implementation: require(`../gatsby-node.js`), + cssLoaderOptions: { camelCase: false }, postCssPlugins: [{ post: `CSS plugin` }], sassRuleTest: /\.global\.s(a|c)ss$/, sassRuleModulesTest: /\.mod\.s(a|c)ss$/, diff --git a/packages/gatsby-plugin-sass/src/gatsby-node.js b/packages/gatsby-plugin-sass/src/gatsby-node.js index 450d9c7a98649..e5df5a9749eb4 100644 --- a/packages/gatsby-plugin-sass/src/gatsby-node.js +++ b/packages/gatsby-plugin-sass/src/gatsby-node.js @@ -84,6 +84,11 @@ exports.pluginOptionsSchema = function ({ Joi }) { .description( `By default the node implementation of Sass (node-sass) is used. To use the implementation written in Dart (dart-sass), you can install sass instead of node-sass and pass it into the options as the implementation` ), + cssLoaderOptions: Joi.object({}) + .unknown(true) + .description( + `Pass in options for css-loader: https://github.com/webpack-contrib/css-loader/tree/version-1#options` + ), postCssPlugins: Joi.array() .items(Joi.object({}).unknown(true)) .description(`An array of postCss plugins`),