-
Notifications
You must be signed in to change notification settings - Fork 4
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
Any plans to implement @include? #8
Comments
I haven't touched that code in awhile, but a basic include shouldn't be too hard, depending on how it finds files. Do you have any ideas on how the format should look? I'd probably lean toward a relative import solution that supports unix-style paths. So: @import foo.js ..that sort of thing. We'd basically be handing the path over to a Python open() after resolving the relativeness. |
Doing a basic @include wasn't too bad. Check out the diff above and see what you think. It's a multi-pass include, so you can use jsmacro macros in the included files as well. I only added one test file though (although it does a couple different tests within it.) Cheers! |
Hey Erik, Thanks for the quick turnaround! The syntax seems perfectly reasonable. I was a bit surprised that the files are not wrapped in quotes, but this would only be an issue if the filenames contain spaces, which is unlikely. So, it works in simple cases, but I ran into several issues with more complicated scenarios:
a.js: b.js: ./jsmacro.py -f a.js//#include b.js But if a.js contains, say an #ifdef, then it works.
#2 is the only showstopper here. Otherwise it's a pretty useful little tool. Thanks again. |
Sounds like I need to write some more tests! :-) I find that first "1." confusing because I'm pretty sure I tested that. I'll need to try replicated it. One thing that is a little strange with the current implementation is that it requires an #end, which is goofy. (I opened ticket #11 to fix this.) Quotes (and spaces-in-filenames) didn't even cross my mind. Seems reasonable to (optionally) allow them. I opened a new ticket (#9) to track that feature. Supporting conditional includes is awesome. I opened ticket #10 for that. |
Thanks! Speaking of which, I just thought of another useful feature... user-defined //#ifdef DEBUG function fn() { I have a feeling this one is going to be tricky. Especially the handling of On Wed, Sep 12, 2012 at 2:29 PM, smartt [email protected] wrote:
|
Hi,
It would be nice to be able to pull in dependencies into a file before processing it. I just looked at the code, so I'm not sure how feasible this is.
Thanks!
The text was updated successfully, but these errors were encountered: