1.1.0 • Published 9 years ago

gulp-wraptemplate v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 years ago

Install

npm install gulp-wraptemplate

Usage

Wrap up tempalte file

Global variables using "template_" + the file name

var wraptemplate = require("gulp-wraptemplate");

gulp.task("wraptemplate",function(){
    return gulp.src(src+"/tpl/*.html")
        .pipe(wraptemplate())
        .pipe(gulp.dest(src+"/js/tpl"))
});

Example

template file (index.html)

<div class="item">
    <p><%= item.name%></p>
</div>

module file (index.js)

!(function(root, factory) {
    if (typeof module !== "undefined" && module.exports) {
        module.exports = factory(root);
    } else if (typeof define === "function") {
        define(function() {
            return factory(root);
        });
    } else {
        root.template_index = factory(root);
    }
}(this, function(root) {
    return "<div class=\"item\">\n    <p><%= item.name%></p>\n</div>";
}));

LICENSE

MIT

1.1.0

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago