0.2.0 • Published 9 years ago

gulp-glob-html v0.2.0

Weekly downloads
3
License
-
Repository
github
Last release
9 years ago

#gulp-glob-html

Add globbing to your HTML

Installation

npm install --save-dev gulp-glob-html

Information

With gulp-glob-html you can use glob functionality in your html templates:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>glob-html example</title>

    <link href="css/*.css" rel="stylesheet" type="text/css">

    <script src="scripts/*"></script>
</head>
<body>
    <p>glob-html example</p>
</body>
</html>

and receive the template with matched css and js entries:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>glob-html example</title>

    <link href="css/style1.css" rel="stylesheet" type="text/css">
    <link href="css/style2.css" rel="stylesheet" type="text/css">
    <link href="css/style3.css" rel="stylesheet" type="text/css">

    <script src="scripts/script1.js"></script>
    <script src="scripts/script2.js"></script>
    <script src="scripts/script3.js"></script>
</head>
<body>
    <p>glob-html example</p>
</body>
</html>

Examples

var gulp = require('gulp'),
    globhtml = require('gulp-glob-html');

gulp.task('default', function () {
    return gulp.src('./templates/**/*.html')
        .pipe(globhtml())
        .pipe(gulp.dest('./temp'));
});

Use 'basePath' option to skip url prefix:

var gulp = require('gulp'),
    globhtml = require('gulp-glob-html');

gulp.task('default', function () {
    return gulp.src('./templates/**/*.html')
        .pipe(globhtml({ basePath: "../dist/" }))
        .pipe(gulp.dest('./temp'));
});

License

MIT @ Eugene Gluhotorenko