How to use gulp-pug - 10 common examples

To help you get started, we’ve selected a few gulp-pug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andrew--r / frontendbookshelf / gulp / tasks / templates.js View on Github external
gulp.task('templates', () => {
	return gulp
		.src(`${PATHS.source.templates.pages}/**/*.pug`)
		.pipe(plumber(getPluginOptions('plumber')))
		.pipe(getData(() => glob
			.sync(`${PATHS.source.data}/**/*.json`)
			.map(parseDataFile)
			.concat({ books, tags })
			.reduce(mergeObjects, {})))
		.pipe(pug(getPluginOptions('pug')))
		.pipe(rename((path) => {
			if (path.basename !== 'index') {
				path.dirname = path.basename; // eslint-disable-line no-param-reassign
				path.basename = 'index'; // eslint-disable-line no-param-reassign
			}
		}))
		.pipe(gulp.dest(PATHS.build.templates));
});
github jeshan / cloudformation-checklist / gulpfile.babel.js View on Github external
gulp.task('compile-pug', () => {
  return gulp.src(pugPaths.src)
    .pipe(plumber(error => {
      console.log(error);
      this.emit('end');
    }))
    .pipe(data(() => {
      return require(`./data/${argv.l}/_project.json`);
    }))
		.pipe(pug({
      locals: {},
      pretty: true,
    }))
    .pipe(rename({
      basename: 'index',
    }))
    .pipe(gulp.dest(dirs.dest))
    .pipe(browserSync.reload({stream: true}));
});
github zalmoxisus / redux-devtools-extension / gulpfile.babel.js View on Github external
gulp.task('views:dev', () => {
  gulp.src('./src/browser/views/*.pug')
    .pipe(jade({
      locals: { env: 'dev' }
    }))
    .pipe(gulp.dest('./dev'));
});
github parkjs814 / DuoCoder / gulpfile.babel.js View on Github external
gulp.task('build-pug', () => {
  gutil.log('\n\nBuild pug Paths: \n', pugDir, '\n\n');

  var PUG_LOCALS = {
    title: pkg.name,
    description: pkg.description,
    author: pkg.author
  };

  return gulp.src(pugDir)
    .pipe(pug({ locals: PUG_LOCALS }).on('error', onError))
    .pipe(gulp.dest(outputPaths.pug))
    .pipe(connect.reload());
});
github dougludlow / plugin-sass / gulpfile.babel.js View on Github external
gulp.task('pug', ['clean'], () =>
  gulp.src('test/*.pug')
    .pipe(pug())
    .pipe(gulp.dest('.tmp'))
);
github parkjs814 / parkjs814.github.io / gulpfile.babel.js View on Github external
gulp.task('buildPug', () => {
  const locals = {
    description: pkg.description,
    author: pkg.author,
    data: {},
  };
  fs.readdirSync(dataPath).filter(file => file.endsWith('.js')).forEach(file => {
    const name = file.slice(0, -3);
    const filePath = path.join(dataPath, file);
    delete require.cache[require.resolve(filePath)];
    locals.data[name] = require(filePath);
  });
  return gulp
    .src(path.join(pugPath, 'index.pug'))
    .pipe(pug({ locals }))
    .pipe(gulp.dest(builtPath))
    .pipe(connect.reload());
});
github carloscuesta / starterkit / gulpfile.babel.js View on Github external
gulp.task('templates', () => {
	return gulp.src([routes.templates.pug, '!' + routes.templates._pug])
		.pipe(plumber({
			errorHandler: notify.onError({
				title: 'Error: Compiling pug.',
				message: '<%= error.message %>'
			})
		}))
		.pipe(pug())
		.pipe(gulp.dest(routes.files.html))
		.pipe(browserSync.stream())
		.pipe(notify({
			title: 'Pug Compiled succesfully!',
			message: 'Pug task completed.'
		}));
});
github ukonpower / glsl-graphics / gulpfile.babel.js View on Github external
gulp.task('pug', () => {
    return gulp.src([srcBase + 'pug/**/*.pug', srcBase + 'pug/**/_*.pug'])
        .pipe(plumber())
        .pipe(pug({
            pretty: true,
            locals: {
                title: 'gl' + options.gl,
            }
        }))
        .pipe(gulp.dest('./public/gl/'));
});
github itsezc / CycloneIO / gulpfile.babel.js View on Github external
Gulp.task('resources:build:index', () => {
	return Gulp.src('source/web/themes/' + Config.hotel.theme + '/structure.page')
				.pipe(Pug())
				.pipe(Gulp.dest('dist/'))
})
github escueladigital / EDboilerplate / gulpfile.babel.js View on Github external
gulp.task('pug-dev', () =>
  gulp.src('./src/pug/pages/**/*.pug')
    .pipe(plumber())
    .pipe(pug({
      pretty: true,
      basedir: './src/pug'
    }))
    .pipe(gulp.dest('./public'))
)

gulp-pug

Gulp plugin for compiling Pug templates

MIT
Latest version published 4 years ago

Package Health Score

57 / 100
Full package analysis

Popular gulp-pug functions