New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using custom sass functions not working #24
Comments
you can use this sass plugin as alternative. I know this is no real solution to your problem but you can use this sass-plugin util the real problem is fixed. |
@nekator thanks, that worked but I do miss the latest the latest sass features :( |
I have this problem too, did anyone find a solution for this? @quackes Do you have any news on this subject? |
I got around this limitation as well, even for writing my own functions this is a problem. I had to re-export the instance as well to get access to the correct types. I persisted the changes using https://www.npmjs.com/package/patch-package, so I can use this in CI/CD as well. It sure isn't pretty and I recommend caution for those doing this as well. So, why is dart-sass bundled anyway? |
Since 2019 there are no decent way to fix it ? |
I mean, that the instance of dart-sass can be imported by stencil. imho the best solution is not to use bundled dart-sass. |
Had the same problem when updating sass function to from node-sass to dart-sass. The function pulled it's own version of sass from its node_modules, and the
|
@KevinCarnaille2: I'm sorry, I completely missed your question! I modified the
|
Sass offers the api to register custom functions to use in sass stylesheets (https://sass-lang.com/documentation/js-api#functions)
These do not work due to the fact that stencil-sass comes with a packed version of dart-sass
Steps to reproduce
stencil.config.ts
src/global/style.scss
when I run the build the following error occurs
Cause
The error occurs because dart-sass checks the type with
instanceof
, and the called constructor in the custom function implementation is not the same as the constructor checked in the bundled dart-sass code in stencil-sassI "solve" the error reexporting the dart-sass object in stencil-sass and using the types from that module.
Thats not a viable workaround, more a proof of the error cause.
Suggestions
1
I don't know, why dart-sass is bundled with stencil-sass, but one solution would be to skip the bundling and load it as dependency instead of devDependency
2
Reexport the dart-sass instance in order enable the use dart-sass api outside of stencil-sass
However, this would limit the ability to use 3rd-party modules that use dart-sass
The text was updated successfully, but these errors were encountered: