Skip to content

Commit

Permalink
Sub the veda-ui USWDS theme file with the one from veda-config during…
Browse files Browse the repository at this point in the history
… the compilation process
  • Loading branch information
dzole0311 committed Feb 27, 2025
1 parent 3a4b655 commit 9f10c2b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .veda/veda
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,29 @@ if (inputCmd === '--info') {
process.exit();
}

const rootDir = path.join(__dirname, '../');

// Compile SASS to CSS before running other commands
if (inputCmd !== 'clean' && inputCmd !== 'test') {
console.log('Compiling SASS styles...');

const uiDistStyles = path.join(__dirname, 'ui/static/styles');
const vedaUiThemePath = path.join(__dirname, 'ui/app/scripts/styles/_uswds-theme.scss');
const vedaConfigThemePath = path.join(rootDir, 'styles/_uswds-theme.scss');

if (!fs.existsSync(uiDistStyles)) {
fs.mkdirSync(uiDistStyles, { recursive: true });
}

// Copy the veda-config theme file to veda-ui
try {
fs.copyFileSync(vedaConfigThemePath, vedaUiThemePath);
console.log('Substituted veda-config theme file into veda-ui');
} catch (error) {
console.error('Failed to substitute theme file:', error);
process.exit(1);
}

try {
execSync(
'sass --quiet-deps --load-path=node_modules/@uswds/uswds/packages styles/theme.scss .veda/ui/static/styles/theme.css',
Expand All @@ -62,8 +75,6 @@ if (inputCmd !== 'clean' && inputCmd !== 'test') {
const configFile = path.join(__dirname, '../veda.config.js');
process.env.VEDA_CONFIG_PATH = process.env.VEDA_CONFIG_PATH || configFile;

const rootDir = path.join(__dirname, '../');

if (inputCmd === 'test') {
const jestCli = path.join(__dirname, 'ui/node_modules/jest/bin/jest.js');
const jestConfig = path.join(__dirname, 'ui/jest.config.js');
Expand Down

0 comments on commit 9f10c2b

Please sign in to comment.