0.0.4 • Published 9 years ago

gulp-replace-build-block v0.0.4

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

gulp-replace-build-block Build Status

Parse build blocks in HTML and replace blocks with tag linking the block output file. Intended for use in combination with html-build-blocks, gulp-filter and gulp-concat to provide useref like behaviour in gulp.

Inspired by the gulp-useref plugin, but with a signifigantly different design to provide greater modularity and streaming support.

Install

npm install --save-dev gulp-replace-build-block

Usage

The following example will parse HTML and replace build blocks with a link/script to the destination path.

var gulp = require('gulp'),
    replaceblocks = require('gulp-replace-build-block');

gulp.task('default', function() {
    return gulp.src('/html/**/*.html').pipe(replaceblocks())
});

Blocks are expressed as:

<!-- build:<type> <path> -->
~ script tags or link tags ~
<!-- endbuild -->
  • type: either js or css
  • path: the file path of the optimized file, the target output

Blocks are rendered as:

<!-- css blocks -->
<link href="<path>" rel="stylesheet" />
<!-- js blocks -->
<script src="<path>" type="text/javascript"></script>

API

replaceblocks()

Takes no arguments.

License

MIT © Nils Lundquist