-
Notifications
You must be signed in to change notification settings - Fork 465
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 importer C-API and path handling #1509
Improve importer C-API and path handling #1509
Conversation
f8554eb
to
fe33c08
Compare
Does this break any existing functions or have just these two functions
|
There were some changes under the hood to support urls better. Other than that everything should behave as before (perl-libsass unit tests also triggered and are now working again). |
(related: #1160) |
No objections from me. |
@mgreter most of my header tests are passing now. I found one last oddity. If you include a header then do a file compile, the only file that shows up in resolved imports is the header not the file being compiled. Previously, the resolved imports included only the file being compiled and not the header. If I remove the header and do a file compile, the resolved imports includes an absolute path to the file being compiled. Input
Previous:
Now:
Imo, correct:
|
What is |
fe33c08
to
f2c4f35
Compare
sass_context_get_included_files. Yeah I switched to abs_path/imp_path, it On Tue, Sep 1, 2015 at 2:50 AM Marcel Greter [email protected]
|
This shows what I'm talking about
Output: Should be:
|
b115d5c
to
9164888
Compare
9164888
to
9e332d7
Compare
We accessed the hash map directly without checking for existence. This was creating the key with NULL assigned.
…ling Improve importer C-API and path handling
You're case should be covered now. Please open new bugs if I broke anything else! |
So is it considered a bug that the headers are still left out of imports on the file compiler? |
This is by design and I would argue that it doesn't make much sense to include them there (it is included in the source-maps though, as you can see when you enable "Custom Header Test" in srcmap inspector). I guess |
That is fine, I don't have a use case for watching headers just noticed that the unit tests are failing. It might be worth documenting somewhere that headers are not included in the resolved imports list. I did notice these before so that it would be a breaking change from 3.2.5 behavior. |
This is a breaking C-API change, altough only minor and in an experimental feature!
Renamed two API functions to be more close to their actual use:
sass_import_get_path
->sass_import_get_imp_path
sass_import_get_base
->sass_import_get_abs_path
This PR also reworks and should make path handling better understandable. Still far from perfect under the hood, but IMO the API is slowly getting there. It should now support urls correctly.
This also fixes another bug introduced by a fix commited a few days ago. Headers were all stored under the same virtual file-name. Therefore the "cache" always returned the same header. We now add an index to the virtual file-name if multiple headers are included in the same file (Fixes #1505).