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

Compass-style import once behavior #583

Closed
wants to merge 6 commits into from

Conversation

sufianrhazi
Copy link

This adds commpass-style import-once behavior to libsass, without the exclamation point suffix override.

Though this was a closed issue in #450, we depended on this functionality and using ruby sass was simply not performant enough for our needs.

Sufian Rhazi added 5 commits September 25, 2014 15:00
This is recursive across all @import directives, so if the dependency is
deep, it will only be imported when seen first.
Conflicts:
	context.cpp
	context.hpp
	emscripten_wrapper.cpp
	emscripten_wrapper.hpp
@HamptonMakes
Copy link
Member

Well, building it yourself is definitely a damn fine way of registering a strong protest. ;) I for one rather like this, but I know that @nex3 wants a more robust system for sass long term.

We could make a libsass-compass project that adds in functions like this. There are a couple of those, including path handling (image_path, etc) and spriting, etc.

But, I'd also like to point out that you can emulate this behaviour in pure sass too! Foundation does it that way with a map in its export() function. https://github.com/hcatlin/foundation/blob/29ffaad25daa4cfd99f5c9da4143baf89d883565/scss/foundation/_functions.scss

@sufianrhazi
Copy link
Author

Heh, I didn't mean it as a protest, only that it was something we needed and found useful :)

And wow, that's quite a neat trick for import-once emulation!

I totally understand the desire for a more robust system, any thoughts to what that would look like? Also, is there any mechanism/plan/roadmap for the ability to add additional plugins/behaviors to libsass?

@HamptonMakes
Copy link
Member

@sufianrhazi sufianrhazi mentioned this pull request Nov 3, 2014
@sufianrhazi
Copy link
Author

I've just added sassc bindings for enabling this behavior: sass/sassc#78

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) when pulling e8d426c on sufianrhazi:import-once into 068add9 on sass:master.

@drewwells
Copy link
Contributor

Interesting, I'm planning on building this into my libsass implementation. I feel like file I/O could be better handled by impmentation rather than libsass directly. File watcher for instance would be better handled by the libsass implementation.

@xzyfer
Copy link
Contributor

xzyfer commented Mar 9, 2015

As discussed on twitter this belongs in custom importer until modules lands in Sass next.

@xzyfer xzyfer closed this Mar 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants