Skip to content

Commit

Permalink
Add templatify path customization
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Klimenko committed Feb 11, 2016
1 parent 8dc4fa3 commit b73f7bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions gulpy/recipes/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ exports.globs = function() {
return modulesPaths.concat(helpersPaths);
};

exports.compile = function() {
exports.compile = function(outputPath) {
return es.merge(
modules.compile(),
helpers.compile()
modules.compile(null, outputPath),
helpers.compile(null, outputPath)
);
};

Expand Down
11 changes: 6 additions & 5 deletions gulpy/snippets/templatify.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ var handlebarsify = require('../plugins/handlebarsify');

const DEST = 'build/private/';

function templatify(streamOrPaths, declOpts, name) {
function templatify(streamOrPaths, declOpts, name, outputPath) {
name = name || declOpts.namespace;
outputPath = outputPath || DEST;

var stream = streamOrPaths.pipe ? streamOrPaths : gulp.src(streamOrPaths);

var renamer = declOpts.parentBased ?
_.partial(renamers.parentBased, declOpts.parentBased)
: renamers.basename;
_.partial(renamers.parentBased, declOpts.parentBased) :
renamers.basename;

return stream
.pipe(modified('js'))
Expand All @@ -28,7 +29,7 @@ function templatify(streamOrPaths, declOpts, name) {
}))
.pipe(remember('templates.' + name))
.pipe(concat(name + '.js'))
.pipe(gulp.dest(DEST));
.pipe(gulp.dest(outputPath));
}

module.exports = templatify;
module.exports = templatify;

0 comments on commit b73f7bc

Please sign in to comment.