silvinci/gulp-emblem — pull request #9 by wbyoung (2014-03-11 23:49:04+00:00)
Title: Abstracting module definition.

### Background

I wanted to create a new plugin, [gulp-ember-emblem](https://github.com/wbyoung/gulp-ember-emblem).

There are [multiple](https://github.com/fuseelements/gulp-ember-handlebars) [forks](https://github.com/silvinci/gulp-emblem) of [gulp-handlebars](https://github.com/lazd/gulp-handlebars). They seem to have been forked at a different point in time, and they haven't been pulling in changes from from _gulp-handlebars_ as changes have been made. That got me thinking… how can I abstract this a bit so that some of the functionality can change more independently.

I came up with [gulp-define-module](https://github.com/wbyoung/gulp-define-module).

### Request

As you'll see from the request, this is a pretty radical change. I'm hoping that we can somehow either collaborate to get this into each of the plugins that forked from the _gulp-handlebars_ repo. And I think this could end up being a better solution for the gulp community as a whole since it will result in more continuity between each of these plugins.

The basic idea here is that module definition, AMD, Node, CommonJS, or just plain JS can be pulled out into its own module. The resulting gulp flow looks something like this:

```javascript
var handlebars = require('gulp-handlebars');
var defineModule = require('gulp-define-module');

gulp.task('templates', function(){
gulp.src(['client/templates/*.hbs'])
.pipe(handlebars())
.pipe(defineModule('node'))
.pipe(gulp.dest('build/templates/'));
});
```

I'd like to see the [pull request](https://github.com/lazd/gulp-handlebars/pull/17) go through on _gulp-handlebars_ before it gets merged here. Perhaps you can weigh in over on that pull request.

Thanks!