Skip to content

Commit

Permalink
Add comment to not-obvious things in sass-build
Browse files Browse the repository at this point in the history
  • Loading branch information
BPScott committed Nov 20, 2018
1 parent 4076145 commit 7f89ff4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/sass-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export default function generateSassBuild(destinationDir) {
const regex = /:global\s*\(([^)]+)\)|:global\s*{\s*([^}]+)\s*}\s*/;

glob.sync(join(srcDir, '/**/*.scss')).forEach((srcFile) => {
// On Windows `srcFile` contains forwardslashes as path separators (as it
// came from glob) while `srcDir` contains backslashes as path separators
// (as it came from path.join). Replace backslashes with forward-slashes
// to ensure the sassFile gets generated correctly
const sassFile = srcFile.replace(srcDir.replace(/\\/g, '/'), '');
let file = readFileSync(srcFile, 'utf8');
file = file.replace(new RegExp(regex, 'g'), '$1$2');
Expand Down

0 comments on commit 7f89ff4

Please sign in to comment.