Skip to content

Commit

Permalink
refactor: use latest sass compiler from npm (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabon-f authored May 31, 2024
1 parent 3c59fc7 commit 5066971
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 842 deletions.
14 changes: 3 additions & 11 deletions sass_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,8 @@ export async function compile(text: string): Promise<string> {
// Use dynamic import because sass.js is slow to import
const start = performance.now();
console.log("Importing sass");
const { Sass } = await import("./vendor/" + "sass/mod.ts");
const sass = await import("npm:sass@1.77.2");
console.log(`Imported sass in ${(performance.now() - start).toFixed(1)}ms`);
return new Promise((resolve, reject) => {
// deno-lint-ignore no-explicit-any
Sass.compile(text, (result: any) => {
if (result.status === 0) {
resolve(result.text);
} else {
reject(new Error(result.message));
}
});
});
const result = await sass.compileStringAsync(text);
return result.css;
}
2 changes: 1 addition & 1 deletion sass_util_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Deno.test("sass_util - compile", async () => {
const scss = ".foo { &__bar { margin: 0; } }";
const css = await compile(scss);

assertEquals(css, ".foo__bar {\n margin: 0; }\n");
assertEquals(css, ".foo__bar {\n margin: 0;\n}");
});
4 changes: 0 additions & 4 deletions vendor/sass/mod.ts

This file was deleted.

826 changes: 0 additions & 826 deletions vendor/sass/sass.js

This file was deleted.

1 comment on commit 5066971

@deno-deploy
Copy link

@deno-deploy deno-deploy bot commented on 5066971 May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

Relative import path "@std/net/get-network-address" not prefixed with / or ./ or ../

Please sign in to comment.