Skip to content

gevgeny/gulp-glob-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#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

About

Add globbing to your HTML

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published