Skip to content

Commit

Permalink
Fix the way to use node:path module
Browse files Browse the repository at this point in the history
  • Loading branch information
kentaroi committed Aug 13, 2024
1 parent 5a0c050 commit eecf70c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/compile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { posix: path } = require("path");
const path = require("path");
const url = require("url");

const sass = require("sass");
Expand All @@ -10,13 +10,13 @@ const getLoadPathsFixedSassOptions = require("./get-load-paths-fixed-sass-option
const debugDev = require("debug")("Dev:EleventySass:Compile");

const compile = async function(inputContent, inputPath, sassOptions, config, postcss) {
let parsed = path.parse(inputPath);
let parsed = path.posix.parse(inputPath);
if (parsed.name.startsWith("_")) {
debugDev(`Actually, didn't compile ${ inputPath }, because the filename starts with "_"`);
return;
}

let inputURL = url.pathToFileURL(path.resolve(inputPath)).href;
let inputURL = url.pathToFileURL(path.posix.resolve(inputPath)).href;

let stringOptions = getLoadPathsFixedSassOptions(sassOptions, parsed.dir, config);
stringOptions.url = inputURL;
Expand Down Expand Up @@ -54,7 +54,7 @@ const compile = async function(inputContent, inputPath, sassOptions, config, pos
// By calling `depMap.update()` with `dependant` and `loadedPaths`, dependencies
// 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.normalize(inputPath);
let dependant = path.posix.normalize(inputPath);
let loadedPaths = loadedUrls.map(loadedUrl => path.relative('.', url.fileURLToPath(loadedUrl)));
depMap.update(dependant, loadedPaths);

Expand Down

0 comments on commit eecf70c

Please sign in to comment.