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

included_files not importing path properly depending on Sass_Import content #1040

Closed
rodneyrehm opened this issue Apr 2, 2015 · 3 comments
Closed

Comments

@rodneyrehm
Copy link
Contributor

It seems the included_files (sass_context_get_included_files()) content is not populated properly when the Sass_Import contains contents.

With the following FS:

/sass/testfile.scss
  .test { content: "loaded"; }

And the source

@import "testfile";

I expect sass_context_get_included_files() to return [ "/sass/loadfile" ] with the following importers:

struct Sass_Import** importer_void(const char* cur_path, Sass_Importer_Entry cb, struct Sass_Compiler* comp) {
  return NULL;
}

struct Sass_Import** importer_file(const char* cur_path, Sass_Importer_Entry cb, struct Sass_Compiler* comp) {
  struct Sass_Import** list = sass_make_import_list(1);
  list[0] = sass_make_import_entry(strdup("/sass/testfile.scss"), 0, 0);
  return list;
}

struct Sass_Import** importer_file_content(const char* cur_path, Sass_Importer_Entry cb, struct Sass_Compiler* comp) {
  struct Sass_Import** list = sass_make_import_list(1);
  list[0] = sass_make_import_entry(strdup("/sass/testfile.scss"), strdup(".test {content: "injected"}"), 0);
  return list;
}

My expectation is met by the first two. But with the last one, importer_file_content, I get [ "testfile" ].


While we're on the subject of importers and included_files, what should happen, were I to set an import_entry's path to http://example.org/foo.scss?

@mgreter
Copy link
Contributor

mgreter commented Apr 2, 2015

AFAIR this was also reported by someone to node-sass (//cc @am11). Looks like we add absolute paths in one place and relative/resolved paths to the input file in the other. Will investigate next!

For your other question, you simply return it with some loaded content, like

sass_make_import_entry("http://example.org/foo.scss", content);

This will then parse the content and report errors etc. with the url you have given. If more imports are found inside content, the previous path you can query will say http://example.org/foo.scss.

@mgreter mgreter added this to the 3.2 milestone Apr 2, 2015
@mgreter mgreter added the C API label Apr 2, 2015
@mgreter mgreter assigned mgreter and unassigned mgreter Apr 2, 2015
@mgreter
Copy link
Contributor

mgreter commented Apr 8, 2015

I gave it a try, but it's more complicated than I thought. Might give some more info here when I have time,. Will re-scope this to 3.2.1 for now (still marked experimental, so not release critical).

@mgreter mgreter modified the milestones: 3.2.1, 3.2 Apr 8, 2015
@xzyfer xzyfer modified the milestones: 3.2.2, 3.3 May 1, 2015
@mgreter mgreter modified the milestones: 3.4, 3.3 Jun 13, 2015
@mgreter
Copy link
Contributor

mgreter commented Sep 3, 2015

Hey @rodneyrehm! I merged some commits that should address IMO the issues with get_included_files. I'm going to close this for now, but feel free to re-open this or a new one if you think there are still some problems! Btw. thanks for your work on sass.link.js!

@mgreter mgreter closed this as completed Sep 3, 2015
@mgreter mgreter removed this from the 3.4 milestone Sep 3, 2015
@xzyfer xzyfer added this to the 3.3 milestone Sep 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants