-
Notifications
You must be signed in to change notification settings - Fork 27
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
Allow customizing file loading using the new Context trait #85
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! This is something I have considered for some time but not yet implemented, so thanks for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is close to being merged now, just humor me with a few more nitpicks ...
I think I covered everything, to me it looks ready now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think this looks good now. Thank you for the contribution!
Progress: 2784 of 5936 tests passed in dart-sass compatiblilty mode. ## Breaking changes * Update nom to 6.0 rasises the minimally supported compiler version to 1.44.0. Also, the dependency is technically exposed. * `sass::Item::Use` was modified by #84. * `compile_scss_file` is renamed to `compile_scss_path`, and `FileContext` is now a trait, the default implementation is renamed to `FsFileContext` by #85. ## Improvements * Allow customizing file loading by providing a custom impl of a `FileContext`, PR #85. * Support the `@use name as *` syntax, PR #84. * Make `Error::BadValue` a little closer to whats expected. * Handle units in `@for` loops. * Update `nom` to 6.0, PR #83. * Update `rand` to 0.8, PR #86. * Testing is now done with github actions rather than travis (Appveyor remains for window builds). * sass-spec test suite updated to 2021-01-20. Thanks to @paolobarbolini and @alvra for code contributions. Tested with rustc 1.49.0 (e1884a8e3 2020-12-29), 1.44.1 (c7087fe00 2020-06-17), 1.46.0 (04488afe3 2020-08-24), 1.48.0 (7eac88abb 2020-11-16), 1.50.0-beta.8 (1cd030396 2021-01-20), and 1.51.0-nightly (c0b64d97b 2021-01-28).
This change allows customizing how files are loaded.
Changes:
Context
, implemented byFileContext
.Format.write_root()
(and related private ones) to accepting this trait instead of aFileContext
directly.parse_scss_readable()
, likedo_parse_scss_file()
but accepting aRead
.I was considering renaming the original functions from
X_file()
toX_path()
since they accepts paths instead of files. Then the new ones that acceptRead
can becomeX_file()
.This would be a breaking change, however.
parse_imported_scss_readable()
, likeparse_imported_scss_file()
This function isn't used or public so it causes a warning, it can probably be removed.
Error::Input
, from aPathBuf
to aString
.This should be the only backwards incompatible change.
Example of how to use this
given:
then: