Skip to content

Commit

Permalink
fix(command.StaticExportCommand): add entities only once
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianAuth committed Jul 17, 2018
1 parent 0ceaccd commit bff62fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
14 changes: 7 additions & 7 deletions source/command/StaticExportCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class StaticExportCommand extends Command
const md5 = hash.digest('hex');
data.path = value;
data.file = (path.basename(data.asset).split('.').shift()) + '_' + md5 + '.svg#icon';
data.filename = this.svgDirectory + data.file;
data.filename = this.svgDirectory + data.file.replace(/#icon/, '');
data.url = this.createLink(this.svgUrl + data.file);
this.svgs[data.url] = data;
return data.url;
Expand Down Expand Up @@ -376,15 +376,15 @@ class StaticExportCommand extends Command
for (const id in exportHtmlTask.nunjucks.template.calls)
{
const entity = yield entitiesRepository.getById(id);
if (entity)
if (entity && entities.indexOf(entity.entity) == -1)
{
entities.push(entity.entity);
}
}
for (const id of exportHtmlTask.nunjucks.template.extends)
{
const entity = yield entitiesRepository.getById(id);
if (entity)
if (entity && entities.indexOf(entity.entity) == -1)
{
entities.push(entity.entity);
}
Expand Down Expand Up @@ -420,7 +420,7 @@ class StaticExportCommand extends Command
const image = scope.images[imageUrl];
const imageSourcePath = yield imageRenderer.resize(image.image, image.width, image.height, image.forced + '');
const imageDestPath = path.join(basePath, image.filename);
const work = logger.work('Adding image <' + image.image + '>');
const work = logger.work('Adding image <' + image.image + '> as <' + imageDestPath + '>');
yield fs.copy(imageSourcePath, imageDestPath);
logger.end(work);
}
Expand All @@ -431,7 +431,7 @@ class StaticExportCommand extends Command
const asset = scope.assets[assetUrl];
const assetSourcePath = path.join(pathesConfiguration.sites, asset.path);
const assetDestPath = path.join(basePath, asset.filename);
const work = logger.work('Adding asset <' + asset.path + '>');
const work = logger.work('Adding asset <' + asset.path + '> as <' + assetDestPath + '>');
yield fs.copy(assetSourcePath, assetDestPath);
logger.end(work);
}
Expand All @@ -441,8 +441,8 @@ class StaticExportCommand extends Command
{
const svg = scope.svgs[svgUrl];
const svgSourcePath = path.join(pathesConfiguration.sites, svg.path.replace(/#icon/, ''));
const svgDestPath = path.join(basePath, svg.url.replace(/#icon/, ''));
const work = logger.work('Adding svg <' + svg.path + '>');
const svgDestPath = path.join(basePath, svg.filename);
const work = logger.work('Adding svg <' + svg.path + '> as <' + svgDestPath + '>');
yield fs.copy(svgSourcePath, svgDestPath);
logger.end(work);
}
Expand Down
6 changes: 1 addition & 5 deletions source/configuration/StaticModuleConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ class StaticModuleConfiguration extends Base
this._cssUrlTemplate = buildConfiguration.get('static.cssUrlTemplate', globalConfiguration.get('static.cssUrlTemplate', ''));
this._jsDirectoryTemplate = buildConfiguration.get('static.jsDirectoryTemplate', globalConfiguration.get('static.jsDirectoryTemplate', 'js'));
this._jsUrlTemplate = buildConfiguration.get('static.jsUrlTemplate', globalConfiguration.get('static.jsUrlTemplate', ''));
this._copyAssets = buildConfiguration.get('static.copyAssets', globalConfiguration.get('static.copyAssets',
{
'base/global/assets/fonts/*.*': 'assets/fonts',
'base/global/assets/images/*.*': 'assets/images'
}));
this._copyAssets = buildConfiguration.get('static.copyAssets', globalConfiguration.get('static.copyAssets', {}));
}


Expand Down

0 comments on commit bff62fc

Please sign in to comment.