Created
January 14, 2018 18:54
-
-
Save mootari/cb44a9d7c48434f1561d7b0ea91dbf31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const app = require('assemble')(); | |
app.use(require('./task-namespace')()); | |
// Shared init task for all sources. | |
app.task('init', function(next) { | |
//app.layouts(abs(config.layouts)); | |
//app.partials(abs(config.partials)); | |
next(); | |
}); | |
// Shared build task for all sources. | |
app.task('build', ['init']); | |
app.use(require('./source-guide')('guide', {})); | |
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(name, options) { | |
return function run(app) { | |
const addTask = app.taskNamespace(name); | |
const collection = app.create(name, { | |
engine: 'hbs', | |
}); | |
addTask('init', function(next) { | |
//collection.addViews(options.src); | |
next(); | |
}); | |
addTask('build', ['init'], function(next) { | |
return collection.toStream(); | |
// .pipe(app.renderFile()) | |
// .pipe(app.dest(options.dest)); | |
}); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(options) { | |
return function(app) { | |
app.define('taskNamespace', function(namespace) { | |
return function(taskName, deps, fn) { | |
if(!fn && typeof deps === 'function') { | |
fn = deps; | |
} | |
if(!Array.isArray(deps)) { | |
deps = []; | |
} | |
deps = deps.map(fullName); | |
app.task(fullName(taskName), deps, fn); | |
if(!app.tasks.hasOwnProperty(taskName)) { | |
app.task(taskName, []); | |
} | |
app.tasks[taskName].deps.push(fullName(taskName)); | |
}; | |
function fullName(taskName) { | |
return taskName + ':' + namespace; | |
} | |
}); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment