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

setting the open/close template wrapper doesn't seem to work #1287

Closed
RobKohr opened this issue Aug 15, 2012 · 4 comments
Closed

setting the open/close template wrapper doesn't seem to work #1287

RobKohr opened this issue Aug 15, 2012 · 4 comments

Comments

@RobKohr
Copy link

RobKohr commented Aug 15, 2012

This was working before the 3.0 release. I use [% %] to wrap my ejs code in templates, and set it with view options like so:

app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
ejs.open = '{{';
ejs.close = '}}';
app.set('view options', {
    open: '[%',
    close: '%]'
});
app.engine('.html', require('ejs').renderFile);

but now it seems to ignore the [% %] tags.

@tj
Copy link
Member

tj commented Aug 15, 2012

use

app.locals.open = '[%';
app.locals.close = '%]';

@RobKohr
Copy link
Author

RobKohr commented Aug 16, 2012

Thanks, that seemed to work on the top level view, but included views it doesn't apply to. For example, I have in index.html

[%-include users/login.html %]

in login.html I have some [% %] code blocks, but they are not being recognized.

@tj
Copy link
Member

tj commented Aug 16, 2012

hmmm maybe the include directive is not passing along those options. open an issue for visionmedia/ejs and I'll have a look when I have a minute

@tj tj closed this as completed Aug 16, 2012
@gipsic
Copy link

gipsic commented Mar 1, 2016

Hi,

You can't expected [%-include users/login.html %] HTML file to be processed when included in ejs path. even you have set in app.js like:
app.engine('.html', require('ejs').renderFile);

please try

[%-include users/login.ejs %]

and rename the associated file.

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