Package Exports
- gulp-declare
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-declare) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gulp-declare

declare plugin for gulp 3
Usage
First, install gulp-declare as a development dependency:
npm install --save-dev gulp-declareThen, add it to your gulpfile.js:
var handlebars = require('gulp-handlebars');
var declare = require('gulp-declare');
gulp.task('templates', function(){
gulp.src(['client/templates/*.hbs'])
.pipe(handlebars()) // returns a bare function
.pipe(declare({
namespace: 'MyApp.templates'
}))
.pipe(concat('templates.js'))
.pipe(gulp.dest('build/js/'));
});API
declare(options)
options.namespace
Type: String
Default: Empty string
The namespace in which the file contents will be assigned. Use dot notation (e.g. App.Templates) for nested namespaces or false to declare templates in the global namespace.
For example, if the namespace is MyApp.Templates and a template is named App.Header.hbs, the following declaration will be present in the output file for that template:
this["MyApp"] = this["MyApp"] || {};
this["MyApp"]["templates"] = this["MyApp"]["templates"] || {};
this["MyApp"]["templates"]["App"] = this["MyApp"]["templates"]["App"] || {};
this["MyApp"]["templates"]["App"]["Header"] = function () {};When processing multiple templates under a given namespace, this will result in duplicate declarations. That is, the non-destructive declaration of the namespace will be repeated for each template compiled.
options.processName
Type: Function
Default: Strip file extension
This option accepts a function which takes one argument (the filepath) and returns a string which will be used as the key for object. By default, the filename minus the extension is used.
If this function returns a string containing periods (not including the file extension), they will be represented as a sub-namespace. See options.namespace for an example of the effect.