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

Support exporting dynamicMixins somehow #38

Open
jonnyscholes opened this issue Jul 28, 2015 · 2 comments
Open

Support exporting dynamicMixins somehow #38

jonnyscholes opened this issue Jul 28, 2015 · 2 comments

Comments

@jonnyscholes
Copy link

Heya so I've made a modified version of jadeify that just looks for mixins in the required jade file and returns them as template functions. It's pretty hacky as jade doesnt expose a nice way to do this currently - but it does work.

It would be possible to integrate that back into this project somehow - the question is should it be? Check out the repo and let me know what you think.

If you think it's a not-too-abhorrent idea I could submit a PR. Or alternatively if you can see a far less hacky way of getting this done please let me know!

@domenic
Copy link
Owner

domenic commented Jul 29, 2015

Fascinating. I've never used this feature of Jade, but it seems pretty cool. I'm not sure how or whether it should integrate with jadeify. For example, can I define a template (like normal jadeify) and a mixin? What about several mixins? The readme implies the name matters but doesn't give an example of more than one mixin.

My initial instinct is that this is better as a separate package, but I'm willing to be persuaded.

The hackiness is also pretty crazy. Have you considered asking the Jade maintainer for some new APIs that would make it less hacky? The eval in particular is concerning.

@jonnyscholes
Copy link
Author

It is very useful - but you're right it is a very, very hacky workaround the lack of a mixin API. It just got even more hacky as it now supports mixins within mixins - which is a concern but the end result is very useful...

There is some chatter over here but it depends on another PR in 2.0 that sounds like it may not get in.

I think I could make them work together - but it would probaly require an API change for jadeify. After further thought I think it should probably stay separate unless it becomes less hacky. Whilst it works and I will add some tests I feel like it may well end up being a maintenance nightmare considering it relies on unexposed functionality to work. Cheers for even considering it though :p

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

No branches or pull requests

2 participants