Skip to content
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

Improve relative path handling for @use #137

Merged
merged 9 commits into from
May 15, 2022
Merged

Improve relative path handling for @use #137

merged 9 commits into from
May 15, 2022

Conversation

kaj
Copy link
Owner

@kaj kaj commented Apr 14, 2022

This should fix some problems with relative paths in @use, while making some more error messages dart-sass compatible.

It also exposes, and hopefully fixes, a windows path problem, first reported by @fasterthanlime on twitter, and fixes #139.

@kaj kaj force-pushed the use-path-stuff branch 4 times, most recently from 91340c8 to c52b8a1 Compare April 20, 2022 18:11
@kaj kaj force-pushed the use-path-stuff branch 5 times, most recently from c7a03cc to 5ddf0a3 Compare May 14, 2022 20:28
kaj added 9 commits May 15, 2022 00:38
This should fix some problems with relative paths in `@use`, while
making some more error messages dart-sass compatible and maybe
exposing a windows path problem.
Paths in sass are url paths, but the path to the initial file
to open from command-line or api is a std::fs::Path.  On unix
this does not really matter, but on other operating systems,
like windows, there might be important differences.

So isolate the std::fs::Path handling to where it is needed and
try to keep the url-path handling clean in other places.
Fixes #139.

Plain css `@import` rules is only allowed on a few condtions.
Currently rsass considers any unresolved `@import` a plain css import,
but in many cases it should signal an error instead.

https://sass-lang.com/documentation/at-rules/import#plain-css-imports
@kaj kaj merged commit 132cad5 into master May 15, 2022
@kaj kaj deleted the use-path-stuff branch May 15, 2022 12:35
kaj added a commit that referenced this pull request May 17, 2022
Released 2022-05-17 (On the Norwegian Constitution day 🇳🇴).
Progress: 4331 of 6523 tests passed in dart-sass compatibility mode.

* Update minimum supported rust version to 1.49.0 (from 1.45.2).
* `SourceFile.parse()` now returns a `Result<Parsed>` rahter than a
  `Result<Vec<sass::Item>>`, and `Format::write_root` now takes a
  `Parsed` (PR #140).
* `FsFileContext::file` is replaced by `FsFileContext::for_path`,
  which initializes a file context and loads a file from it (PR 137).

* Hopefully improved relative file finding on windows (PR #137).
* Plain css `@import` rules is only allowed [on a few
  condtions](https://sass-lang.com/documentation/at-rules/import#plain-css-imports),
  in other cases an error is reported (Issue #139, PR #137).
* Rsass can now parse (some) plain css as well as scss.  Css files can
  be referenced in `@use` and `@import` directives, as well as in the
  `meta.load-css` mixin (PR #140).
* Make the `calc(...)` function signal an error when args are known to
  be invalid css (PR #138).
* Change `map.deep-merge` to match recent change in dart sass.
* Minor fix in whitespace around at-rules.
* Instrumented attempted file loading with `tracing` (PR #137).
* Fix a typo in LICENSE (Issue #136).
* Update sass-spec test suite to 2022-05-10.
* Make rust version of sass-spec more directory-aware (which fixes one
  of 5825 tests).
* Use a crates badge that actually works.

Thanks to @jonassmedegaard for #136, and to @fasterthanlime for
reporting the problem that #137 attempts to fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limit plain css @import directives
1 participant