1.0.11 • Published 7 years ago

gulp-hi v1.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
7 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

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago