Skip to content

Commit

Permalink
feat(pv-stylemark): add support for the aasets option of stylemark
Browse files Browse the repository at this point in the history
  • Loading branch information
mbehzad committed Apr 10, 2024
1 parent 2085297 commit 3be4c2c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/pv-stylemark/tasks/lsg/buildDDS.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -12,6 +13,7 @@ const buildDDS = async () => {
await buildLsgPage(lsgData, config);
await buildLsgExamples(lsgData, config);
await copyUiAssets();
await copyAssets(config);
};

module.exports = {
Expand Down
23 changes: 23 additions & 0 deletions packages/pv-stylemark/tasks/lsg/copyAssets.js
Original file line number Diff line number Diff line change
@@ -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,
};

0 comments on commit 3be4c2c

Please sign in to comment.