Skip to content

Commit

Permalink
Fix unchanged revision hashes in Windows
Browse files Browse the repository at this point in the history
Use `upath` package to make all file paths become in POSIX style.
  • Loading branch information
kentaroi committed Aug 13, 2024
1 parent cf173c1 commit 66d1075
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/compile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require("path");
const upath = require("upath");
const url = require("url");

const sass = require("sass");
Expand All @@ -9,6 +10,8 @@ const getLoadPathsFixedSassOptions = require("./get-load-paths-fixed-sass-option

const debugDev = require("debug")("Dev:EleventySass:Compile");

const workingDir = upath.normalize(process.cwd());

const compile = async function(inputContent, inputPath, sassOptions, config, postcss) {
let parsed = path.posix.parse(inputPath);
if (parsed.name.startsWith("_")) {
Expand Down Expand Up @@ -55,7 +58,7 @@ const compile = async function(inputContent, inputPath, sassOptions, config, pos
// become self-referential. This means that `dependantsOf()` for an updated file
// returns not only files that depend on it but also the updated file itself.
let dependant = path.posix.normalize(inputPath);
let loadedPaths = loadedUrls.map(loadedUrl => path.relative('.', url.fileURLToPath(loadedUrl)));
let loadedPaths = loadedUrls.map(loadedUrl => path.posix.relative(workingDir, url.fileURLToPath(loadedUrl, {windows: false })));
depMap.update(dependant, loadedPaths);

return css;
Expand Down

0 comments on commit 66d1075

Please sign in to comment.