shannonmoeller / gulp-hb

A sane Gulp plugin to compile Handlebars templates. Useful as a static site generator.
http://npm.im/gulp-hb
MIT License
147 stars 14 forks source link

Stream error #6

Closed bringking closed 9 years ago

bringking commented 9 years ago

I am getting the following stream error with what seems to be a basic setup-

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error
    at Object.<anonymous> (/Users/charlesking/woa/node_modules/gulp-hb/node_modules/handlebars/dist/cjs/handlebars/exception.js:26:23)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/charlesking/woa/node_modules/gulp-hb/node_modules/handlebars/dist/cjs/handlebars/base.js:3:17)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

index.html

<h1>Test</h1>
<!-- == FOOTER == -->
{{> templates/footer}}

templates/footer.hbs

{{!-- footer.hbs --}}
<footer>
    <p>test</p>
</footer>

gulpfile

gulp.task('templates', function() {
  return gulp.src('app/**/*.html').pipe(hb({
    partials: [
      'app/templates/*.hbs'
    ]
  })).pipe(gulp.dest('dist'));
});

Any thoughts?

shannonmoeller commented 9 years ago

Partial names are normalized to the file path, minus all common parent directories and the extension name. Given the glob pattern you provided as the partials config value, try just {{> footer}} in your index.html file.

bringking commented 9 years ago

@shannonmoeller thanks, that fixed it.

shannonmoeller commented 9 years ago

Glad to hear it!