2015-10-28 14:36:45 +03:00
|
|
|
/* jscs:disable */
|
2015-06-03 09:25:56 +03:00
|
|
|
module.exports = {
|
|
|
|
name: 'asset-delivery',
|
|
|
|
postBuild: function (results) {
|
|
|
|
var fs = this.project.require('fs-extra'),
|
2015-08-21 19:17:39 +03:00
|
|
|
walkSync = this.project.require('walk-sync'),
|
|
|
|
assetsIn = results.directory + '/assets',
|
2015-06-03 09:25:56 +03:00
|
|
|
templateOut = '../server/views/default.hbs',
|
2015-08-21 19:17:39 +03:00
|
|
|
assetsOut = '../built/assets',
|
|
|
|
assets = walkSync(assetsIn);
|
2015-02-14 07:03:16 +03:00
|
|
|
|
2015-06-03 09:25:56 +03:00
|
|
|
fs.ensureDirSync(assetsOut);
|
|
|
|
|
2015-08-21 19:17:39 +03:00
|
|
|
fs.copySync(results.directory + '/index.html', templateOut, {clobber: true});
|
|
|
|
|
|
|
|
assets.forEach(function (relativePath) {
|
|
|
|
if (relativePath.slice(-1) === '/') { return; }
|
|
|
|
|
|
|
|
fs.copySync(assetsIn + '/' + relativePath, assetsOut + '/' + relativePath, {clobber:true});
|
|
|
|
});
|
2015-06-03 09:25:56 +03:00
|
|
|
}
|
|
|
|
};
|