0.1.7 • Published 7 years ago

gulp-include-sources v0.1.7

Weekly downloads
4
License
ISC
Repository
-
Last release
7 years ago

This module helps you to include files, that you've listed in a simple HTML comment. New files will be generated with the correct tags and files.

It's something like grunt-include-source

Example gulp task:

const includeSource = require("gulp-include-sources");

gulp.task("default", function(){
    return gulp.src("./test/src/*.html")   
        .pipe(includeSource())
        .pipe(gulp.dest("./test/dest/"));});
}`

That's inside /src/index.html: <!-- include: "type": "js", "files": ["scripts/test.js"] -->

That's going to be generated (if the files exist): <script src='scripts/test.js'></script>'

When listed files are not found, the comment won't be replaced and you will get a warning in the console.

Default configuration:

const DEFAULT_OPTIONS = {
    includesDir: "./",
    prefix: "<!-- ",
    suffix: " -->",
    debug: false,
    templates: {
        "js": '<script src="{filePath}"></script>',
        "css": '<link rel="stylesheet" type="text/css" href="{filePath}" />'
    }
};