Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Mistake on importers documentation #2467

Open
@danifornells

Description

According the readme file, the importers callback accept a single object:

done (Function) - a callback function to invoke on async completion, takes an object literal containing: file (String) - an alternate path for LibSass to use OR contents (String) - the imported contents (for example, read from memory or the file system)

... but checking your code, you're also accepting arrays of objects as well:

if (returned_value->IsArray()) {
v8::Local<v8::Array> array = returned_value.As<v8::Array>();
imports = sass_make_import_list(array->Length());

In my opinion, makes a lot of sense, at least in my use case where a custom importer, resolves on some cases, the requested file and something else.

Example:

@import "vars";

needs to be resolved as:

@import "themed/vars";
@import "vars";

After spending some hours trying to figure out how to resolve it, I checked your source code, and then was pretty clear. The callback of an importer can also take an array of objects. In my case: [{file: "themed/vars"}, {file: "vars"}]

So after this explanation, my suggestion is simple: if that's a feature, fix the documentation accordingly.

Thanks & 💕

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions