sass / embedded-host-node

A Node.js library that will communicate with Embedded Dart Sass using the Embedded Sass protocol
MIT License
165 stars 29 forks source link

Example comparable to how `sass` works? #210

Closed brycewray closed 1 year ago

brycewray commented 1 year ago

I apologize in advance if this is a dumb question, but I have searched in vain for the answer. Given that this is supposed to be an alternative to the sass package, I’m unclear on how it can be used in a similar way. For example, once the sass package is installed, a package.json script can use it; e.g.,

"style-exe:sass": "sass --no-source-map assets/scss:assets/css"

. . . but I can find no analogous documentation, or references within any of the existing issues, to how one uses embedded-host-node similarly. I understand that its purpose is to download the appropriate binary but, beyond that, it’s not clear how one should proceed, so I would greatly appreciate any guidance on this score. (If it matters, this would be for use with a Hugo project that already uses npm packages and, thus, package.json scripts — but more general information would also be helpful.)

nex3 commented 1 year ago

This package doesn't (currently) provide a CLI executable. https://github.com/sass/dart-sass/issues/1889 is tracking the possibility of adding one, but for now this only supports the JS API for using Sass.

dikaso commented 3 months ago

https://github.com/sass/dart-sass/issues/1889 is closed. Do we have any info on how to use it as cli?

nex3 commented 3 months ago

Fantastic question. We set "bin": {"sass": "./dart-sass/sass"} in the package.json for the individual platform packages, but apparently this is not picked up by npm exec as expected even when running npx sass-embedded-${os}-${arch}. I'll look into why that is.

In the meantime, you can find the executable manually in node_modules/sass-embedded-${os}-${arch}/dart-sass/sass.

nex3 commented 3 months ago

https://github.com/sass/embedded-host-node/pull/313 should make this much simpler (except on Windows under cmd.exe or PowerShell, which are blocked by https://github.com/npm/cmd-shim/issues/152). Once that lands, you'll be able to run npx sass, or just sass if you've installed the package with npm install -g sass-embedded.