diff --git a/packages/pv-stylemark/tasks/lsg/buildDDS.js b/packages/pv-stylemark/tasks/lsg/buildDDS.js index f24acd3..afa2abf 100644 --- a/packages/pv-stylemark/tasks/lsg/buildDDS.js +++ b/packages/pv-stylemark/tasks/lsg/buildDDS.js @@ -2,6 +2,7 @@ const { buildLsgPage } = require("./buildLsgPage"); const { getLsgData } = require("./getLsgData"); const { buildLsgExamples } = require("./buildLsgExamples"); const { copyUiAssets } = require("./copyUiAssets"); +const { copyAssets } = require("./copyAssets"); const { getLsgConfig } = require("../../helper/config-helper"); const { resolveApp, getAppConfig, join } = require("../../helper/paths"); @@ -12,6 +13,7 @@ const buildDDS = async () => { await buildLsgPage(lsgData, config); await buildLsgExamples(lsgData, config); await copyUiAssets(); + await copyAssets(config); }; module.exports = { diff --git a/packages/pv-stylemark/tasks/lsg/copyAssets.js b/packages/pv-stylemark/tasks/lsg/copyAssets.js new file mode 100644 index 0000000..58abdf7 --- /dev/null +++ b/packages/pv-stylemark/tasks/lsg/copyAssets.js @@ -0,0 +1,23 @@ + +const { basename } = require("path"); +const { copy } = require("fs-extra"); + +const { resolveApp, getAppConfig, join } = require("../../helper/paths"); + +async function copyAssets(config) { + if (!config.assets) return; + + for (const assetPath of config.assets) { + const srcPath = resolveApp(assetPath); + const targetPath = resolveApp(join(getAppConfig().destPath, "styleguide", basename(assetPath))); + try { + await copy(srcPath, targetPath); + } catch (error) { + console.error(error); + } + } +}; + +module.exports = { + copyAssets, +};