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

import-once broken when compiling multiple files per eyeglass instance #65

Closed
hitmands opened this issue Sep 18, 2015 · 6 comments · Fixed by #89
Closed

import-once broken when compiling multiple files per eyeglass instance #65

hitmands opened this issue Sep 18, 2015 · 6 comments · Fixed by #89
Labels
Milestone

Comments

@hitmands
Copy link

Hi,
I've an issue on _import-once_.

I have two different scss files that will be compiled in two different css files.
In both of these .scss files (for example: bootstrap.scss and application.scss) I need to import a single file called: _variables.scss.

The import-once module seems to prevent this behaviour and in the second file that requires _variables.scss I obtain

undefined variable: $variableName

is there any workaround for doing this?

Gius

@chriseppstein
Copy link
Contributor

are you using gulp?

@hitmands
Copy link
Author

no, i'm using grunt!

@hitmands
Copy link
Author

Hi,
I Think that the problem depends on ImportUtilities.importOnce, it seems doesn't pay attemption on the output-file that requests the partial...

Please, let me know something because i'am using eyeglass on a my project.

@eoneill
Copy link
Contributor

eoneill commented Sep 22, 2015

I can confirm this issue as well on a metalsmith project. @hitmands, setting enableImportOnce = false should unblock you.

var eyeglass = new Eyeglass(...);
eyeglass.enableImportOnce = false;
...

I'll look into a proper fix.

@eoneill
Copy link
Contributor

eoneill commented Sep 22, 2015

@chriseppstein it seems we don't keep track of the top level file, so we don't have any way of keeping track of what was actually imported into the current context.

That is, in import_utils.js, this.alreadyImported is shared across the eyeglass instance (not per file). So import-once (seemingly) only works if a new instance of eyeglass is created per file.

I think this should really be something like... this.processedFiles[rootFile].alreadyImported, where rootFile is the top most file (the one being compiled).

I did a bit of digging, but I don't think this is currently exposed in the importer. You only seem to have access to the previous file (but not the whole import chain). This might require a patch to node-sass, but I'll keep digging.

@hitmands
Copy link
Author

@eoneill, thanks, but I can't disable the importOnce prop,
I need it too :)

By the way, seems a little-fix, so I'll try in the next days!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants