1.0.11 • Published 10 years ago

gulp-hi v1.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
10 years ago

gulp-handlebars-include

###Install: Install with npm.

npm i gulp-hi --save-dev

###Examples:

var gulp = require('gulp');
var hi = require('gulp-hi');
 
gulp.task('default', function () {
  gulp.src('app/html/*.html')
    .pipe(hi())
    .pipe(gulp.dest('app/'));
});

###How use it in sources: app/html/index.html

<body>
{{ include="app/html/tpl/header.html" class="my-class" data="my-data" title="My Title" }}
</body>

app/html/tpl/header.html example of use handlebars

<div class="header {{ class }}">
    {{ if data }}
    <div class="data" data-my="{{ data }}">{{ title }}</div>
    {{ /if }}
</div>

Result after compile app/index.html

<body>
<div class="header my-class">
    <div class="data" data-my="my-data">My Title</div>
</div>
</body>

###Options:

tplDir - static directory fo templates. Default '/'. Example:

gulpfile.js

gulp.task('default', function () {
  gulp.src('app/html/*.html')
    .pipe(hi({tplDir: '/app/html/tpl/'}))
    .pipe(gulp.dest('app/'));
});

app/html/index.html

<body>
{{ include="header.html" class="my-class" data="my-data" title="My Title" }}
</body>

quotes - single or double. Default double. Example:

gulpfile.js

gulp.task('default', function () {
  gulp.src('app/html/*.html')
    .pipe(hi({quotes: 'single'}))
    .pipe(gulp.dest('app/'));
});

app/html/index.html

<body>
{{ include='header.html' 
link='<a href="#link">Link</a>' 
arr=['one', 'two', 'three']}}
</body>
1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago