2016-11-16 15:27:30 +03:00
|
|
|
/* eslint-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);
|
|
|
|
|
2017-01-16 22:45:13 +03:00
|
|
|
fs.copySync(results.directory + '/index.html', templateOut, {overwrite: true});
|
2015-08-21 19:17:39 +03:00
|
|
|
|
|
|
|
assets.forEach(function (relativePath) {
|
|
|
|
if (relativePath.slice(-1) === '/') { return; }
|
|
|
|
|
2017-01-16 22:45:13 +03:00
|
|
|
fs.copySync(assetsIn + '/' + relativePath, assetsOut + '/' + relativePath, {overwrite: true});
|
2015-08-21 19:17:39 +03:00
|
|
|
});
|
2015-06-03 09:25:56 +03:00
|
|
|
}
|
|
|
|
};
|