binyamin / deno-sass

A sass module for Deno. Wrapper for dart-sass.
MIT License
3 stars 0 forks source link

Support @forward possible? #3

Closed jrson83 closed 2 years ago

jrson83 commented 2 years ago

I'm working with Lume and Deno since some days and I'm a bit shocked about the Deno support for SASS, since actually SASS @import support should be deprecated already, but the timeline has been pushed back.

I tried the Lume SASS plugin and your package I found with some luck. But for both I'm getting the Error:

Error: Error processing page
- page: /styles.scss
- processor: sass
    at (https://deno.land/x/lume@v1.10.1/core/processors.ts:43:19)
    at concurrent (https://deno.land/x/lume@v1.10.1/core/utils.ts:23:33)
    at async Processors.run (https://deno.land/x/lume@v1.10.1/core/processors.ts:32:7)
    at async Site.#buildPages (https://deno.land/x/lume@v1.10.1/core/site.ts:526:5)
    at async Site.update (https://deno.land/x/lume@v1.10.1/core/site.ts:473:9)
    at async Events.dispatchEvent (https://deno.land/x/lume@v1.10.1/core/events.ts:49:11)
    at async callback (https://deno.land/x/lume@v1.10.1/core/watcher.ts:81:24)

Caused by RuntimeError: unreachable
    at <anonymous> (wasm://wasm/00897e32:1:1570850)
    at <anonymous> (wasm://wasm/00897e32:1:2069214)
    at <anonymous> (wasm://wasm/00897e32:1:293069)
    at <anonymous> (wasm://wasm/00897e32:1:1125228)
    at <anonymous> (wasm://wasm/00897e32:1:862192)
    at <anonymous> (wasm://wasm/00897e32:1:1435895)
    at str (https://deno.land/x/denosass@1.0.4/src/wasm/grass.deno.js:266:10)
    at sass (https://deno.land/x/lume@v1.10.1/plugins/sass.ts:48:22)
    at (https://deno.land/x/lume@v1.10.1/core/processors.ts:40:21)
    at concurrent (https://deno.land/x/lume@v1.10.1/core/utils.ts:23:33)

I found this issue on denosass. Is it anyhow possible to fix @forward and make it work? Or does these features also not depend on deno-sass?

binyamin commented 2 years ago

Just to clarify, your error log shows code from hironichu/denosass. This project has nothing to do with that one. That project is a set of Deno bindings for a rewrite of dart-sass, in rust. This project uses dart-sass itself.

jrson83 commented 2 years ago

Sorry I pasted the wrong error log. Here is the right one. When I try to use @import or @forward I'm getting the error:

Error: Error processing page
- page: /styles.scss
- processor:
    at (https://deno.land/x/lume@v1.10.0/core/processors.ts:43:19)
    at concurrent (https://deno.land/x/lume@v1.10.0/core/utils.ts:23:33)
    at async Processors.run (https://deno.land/x/lume@v1.10.0/core/processors.ts:32:7)
    at async Site.#buildPages (https://deno.land/x/lume@v1.10.0/core/site.ts:522:5)
    at async Site.build (https://deno.land/x/lume@v1.10.0/core/site.ts:438:9)
    at async build (https://deno.land/x/lume@v1.10.0/cli/build.ts:36:3)
    at async Command.execute (https://deno.land/x/cliffy@v0.24.2/command/command.ts:1275:7)
    at async (https://deno.land/x/lume@v1.10.0/cli.ts:173:3)

Caused by : Unsupported operation: 'Uri.base' is not supported
    at Object.wrapException (https://esm.sh/v87/sass@1.53.0/deno/sass.js:2:22052)
    at Object.Uri_base (https://esm.sh/v87/sass@1.53.0/deno/sass.js:2:99082)
    at Object.Style__getPlatformStyle (https://esm.sh/v87/sass@1.53.0/deno/sass.js:2:138470)
    at (https://esm.sh/v87/sass@1.53.0/deno/sass.js:238:24244)
    at Object.Me.e.<computed> [as $get$Style_platform] (https://esm.sh/v87/sass@1.53.0/deno/sass.js:2:4351)
    at (https://esm.sh/v87/sass@1.53.0/deno/sass.js:238:23571)
    at Object.Me.e.<computed> [as $get$context] (https://esm.sh/v87/sass@1.53.0/deno/sass.js:2:4351)
    at Frame.get$library (https://esm.sh/v87/sass@1.53.0/deno/sass.js:141:164)
    at Frame.get$location (https://esm.sh/v87/sass@1.53.0/deno/sass.js:141:436)
    at Trace_toString_closure0.call$1 (https://esm.sh/v87/sass@1.53.0/deno/sass.js:141:7980)
binyamin commented 2 years ago

Ah. That's the error we get when sass tries to use a Node.js function. Can you show me the stylesheet and config?

jrson83 commented 2 years ago

Yeah. I created a repo for you here, using lume@v1.10.0, since your repo depends on. Check ./src/styles.scss.

I got the same error, when I tried to create a lume plugin with original npm sass package from esm.sh/sass@1.53.0. I found this issue on vite, providing a fix, maybe it helps. Thank you.

binyamin commented 2 years ago

@jrson83 Thanks so much, that was very helpful. I was able to create another module with a patched version of sass. See https://gitlab.com/binyamin/deno-sass. Also, see https://gitlab.com/binyamin/lume-sass, which uses the patched version.

jrson83 commented 2 years ago

Awesome! I have tested every functionality, it is working everything as intended. @import, @use & @foward all in combination. The Lume SASS plugin should be replaced with this one.

Thank you for fixing this so fast! Now it is finally possible to switch from @import to @use & @forward on Deno. If I run in any issue, I'll let you know.

jrson83 commented 2 years ago

Since the issue has been completely resolved, I'm closing this in favour of https://gitlab.com/binyamin/lume-sass/-/issues/1