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

compileOptions: noEscape is not working #77

Open
uxmoon opened this issue Oct 29, 2019 · 2 comments
Open

compileOptions: noEscape is not working #77

uxmoon opened this issue Oct 29, 2019 · 2 comments

Comments

@uxmoon
Copy link

uxmoon commented Oct 29, 2019

Hi! I have this function setup to compile my hbs files and I'm using a data.json file for the content.

The problem is that I'm trying to use the compileOptions with noEscape set to true but the HTML markup in the .json file is escaped.

My function is the following:

function compileHbs() {

  const hbStream = hb({
      compileOptions: {
        noEscape: true
      }
    })
    .partials('src/html/**/*.hbs')
    .data('src/data.json');

  return gulp
    .src('src/index.hbs')
    .pipe(hbStream)
    .pipe(rename('index.html'))
    .pipe(gulp.dest(folder.build));
}

Any help or hint will be appreciated, thanks!

Edit: Using a triple {{{ is not an option for my project.

@shannonmoeller
Copy link
Owner

shannonmoeller commented Oct 30, 2019

Well that's a problem. I don't have time at the moment to dig into it, but I was able to reproduce your issue. My hunch is that the issue is in the underlying handlebars-wax library. Fortunately, I wrote that too.

I think these are the offending lines:

https://github.com/shannonmoeller/handlebars-wax/blob/master/index.js#L40
https://github.com/shannonmoeller/handlebars-wax/blob/master/index.js#L259

@shannonmoeller
Copy link
Owner

shannonmoeller commented Oct 30, 2019

I think I'll need to rewrite handlebars-wax to remove the use of require hooks. Especially with unflagged import support coming in Node 12.7.

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