gulp-js-inline
v0.0.2
Published
Inline text files in javascript
Downloads
2
Readme
gulp-js-inline
Gulp plutin to inline text files in javascript. This is useful for deploying resources that should be available to javascript such as templates.
Usage
Input:
var gulp = require('gulp');
var concat = require('gulp-concat');
var inline = require('gulp-js-inline
var DESTDIR = 'dist';
gulp.task('templates', function () {
gulp.src(['templates/*.html'])
.pipe(inline({
strip: 1
}))
.pipe(concat('templates.js'))
.pipe(gulp.dest(DESTDIR));
});
Output:
+(function(store){store['hero.html']='<div>...</div>';})(window._templates=window._templates||{});
+(function(store){store['info.html']='<div>...</div>';})(window._templates=window._templates||{});
Options
name
: variable name used to store resources (defaults towindow._templates
)relative
: store resources identified by their name relative to the current working directory (defaults totrue
)strip
: stripstrip
levels; similar topatch -pnum
(defaults to0
)