RandomEtc / ejs-locals

Express 3.x layout, partial and block template functions for the EJS template engine.
298 stars 63 forks source link

Unable to include a package using path starting with application root #10

Closed dmitry-solomadin closed 11 years ago

dmitry-solomadin commented 12 years ago

It is very common behaviour that when we use following code:

include("/folder/script")

the include function should start search for script in /APP_ROOT/folder/script currently instead of application root it uses current folder.

RandomEtc commented 12 years ago

Can you post a fuller example and help me understand how this differs from #9? Thanks!

RandomEtc commented 11 years ago

Closing this, I added some tests for absolute includes in v0.2.2 and I couldn't reproduce your issue. Please re-open if you're still experiencing this problem!

dmitry-solomadin commented 11 years ago

Hi,

Please reopen issue. First of all I tried to run tests and 7 of them fail with 500 error, the only common thing between those 7 test is call for "include" function. I tried to run test on pure install.

Second. Your absolute include test is a bit wrong. You are trying to include partial with absolute path from the root folder and it of course should pass. Just place "with-absolute-include.ejs" into "subfolder" and try to run the test again it would fail because it would look for "locals" partial not from "root/locals" but from "root/subfolder/locals".

Sorry, I cannot write real test because as I stated tests are already failing for me.

RandomEtc commented 11 years ago

Hmm - it sounds ba that the tests don't work at all. Let's fix that first.

Can you paste the results of npm test and npm ls? And the version of node are you using? And what platform?

dmitry-solomadin commented 11 years ago

Here is npm testhttp://pastebin.com/n9xUgVqw Here is npm lshttp://pastebin.com/H8A7UVCm I use mac os x mountain lion, node version is v0.8.7

yuri-karadzhov commented 11 years ago

I have the same issue. Any updates on it?

I use Linux x86_64 and node v0.8.9

RandomEtc commented 11 years ago

Sorry for delayed response on this thread. I've re-opened the issue so I don't forget to take a look at why the tests fail, but I haven't figured it out yet.

Did you install from npm, or from git clone?

yuri-karadzhov commented 11 years ago

I have npm installation.

dmitry-solomadin commented 11 years ago

I tried both.

RandomEtc commented 11 years ago

For those still following along with this issue: I just tested with a fresh download of ejs-locals and I'm getting the same errors with the tests. Hopefully I can figure that out this evening.

RandomEtc commented 11 years ago

AHA.

EJS itself now has include functionality which unfortunately overrides the include function in ejs-locals. This means that EJS can now compose templates by itself which is great.

It also means that the include functionality in ejs-locals should be removed. Will do.

RandomEtc commented 11 years ago

Closing this. I have removed include from ejs-locals. You should be able to use include from EJS itself now, and it should be better tested/maintained.