Skip to content

Commit

Permalink
Remove slash from PostCSS config
Browse files Browse the repository at this point in the history
Prevents future upgrade to `slash@5` (ESM only) but we can’t yet use `postcss.config.mjs` without `postcss-load-config@4`
  • Loading branch information
colinrotherham committed Nov 8, 2022
1 parent 052b372 commit eb2788f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { parse } = require('path')
const autoprefixer = require('autoprefixer')
const cssnano = require('cssnano')
const slash = require('slash')
const minimatch = require('minimatch')
const pseudoclasses = require('postcss-pseudo-classes')
const unmq = require('postcss-unmq')
const unopacity = require('postcss-unopacity')
Expand All @@ -16,9 +16,9 @@ const unrgba = require('postcss-unrgba')
* @returns {{ plugins: import('postcss').Transformer[] }} PostCSS config
*/
module.exports = ({ env, file = '' }) => {
const { dir, name } = parse(
// Normalise to string path with forward slashes
slash(typeof file === 'object' ? file.path : file)
const { dir, name } = parse(typeof file === 'object'
? file.path // Normalise to string path
: file
)

// IE8 stylesheets
Expand All @@ -35,7 +35,7 @@ module.exports = ({ env, file = '' }) => {

// Add review app auto-generated 'companion' classes for each pseudo-class
// For example ':hover' and ':focus' classes to simulate form label states
if (dir.endsWith('app/assets/scss') && (name === 'app' || name.startsWith('app-'))) {
if (minimatch(dir, '**/app/assets/scss') && (name === 'app' || name.startsWith('app-'))) {
plugins.push(pseudoclasses({
restrictTo: [
':link',
Expand Down

0 comments on commit eb2788f

Please sign in to comment.