panini icon indicating copy to clipboard operation
panini copied to clipboard

Panini does not output pages with html extension when pages are .hbs

Open TeriyakiBomb opened this issue 6 years ago • 4 comments

So looking at the gulpfile, the pages task the src accepts three different extensions, But when I save my pages as .hbs, panini keeps the .hbs extension in dist is there something I'm missing?

  return gulp.src('src/pages/**/*.{html,hbs,handlebars}')
    .pipe(panini({
      root: 'src/pages/',
      layouts: 'src/layouts/',
      partials: 'src/partials/',
      data: 'src/data/',
      helpers: 'src/helpers/'
    }))
    .pipe(gulp.dest(PATHS.dist));
}```

TeriyakiBomb avatar Jun 01 '18 15:06 TeriyakiBomb

A workaround I found is:

  1. Install a Gulp plugin which will change the extension of all your files: npm install gulp-ext-replace --save-dev (NPM link)

  2. Add it to the top of your gulpfile:

var ext_replace = require('gulp-ext-replace');
  1. Update your Gulp task:
gulp.task('default', function () {
    return gulp.src('src/pages/**/*.{html,hbs,handlebars}')
        .pipe(panini({
            root: 'src/pages/',
            layouts: 'src/layouts/',
            partials: 'src/partials/',
            data: 'src/data/',
            helpers: 'src/helpers/'
        }))
        .pipe(ext_replace('.html')) // <-- this will rename all your output files to `.html`
        .pipe(gulp.dest(PATHS.dist));
})

nwittwer avatar Oct 01 '18 13:10 nwittwer

Yeah, that's what I did in the end. But it's still a bug I think?

TeriyakiBomb avatar Oct 01 '18 14:10 TeriyakiBomb

It is indeed a bug. I'll take a PR if someone wants to write one 👌

gakimball avatar Oct 10 '18 18:10 gakimball

It is indeed a bug. I'll take a PR if someone wants to write one

It would be cool to have all files in handlebars format in panini js

webdevyriy avatar Apr 23 '20 16:04 webdevyriy