Theme Build

Copied!
Shell
cd wp-content/themes/aegiscomposer installnpm installnpm run build # Theme blocks → src/Blocks/npm run dev # Watch mode

Output: src/Blocks/ (countdown, slider, slide, toggle, toggle-content, related-posts). These are the theme’s fallback copies; Aegis Dash provides the same blocks.

Video uses WordPress core/video; the player and its editor assets are built in the Aegis Video add-on. For the Aegis Dash build, see Aegis Dash Building Assets.

Plugin Build

Copied!
Shell
cd wp-content/plugins/aegis-dashnpm installnpm run build # Admin app + the six TypeScript blocks (does not compile Map/Modal)

See Aegis Dash Building Assets.

Build Toolchain

ToolPurpose
@wordpress/scriptsWordPress-specific Webpack configuration
WebpackModule bundler
BabelJavaScript transpilation
PostCSSCSS processing
Sass (optional)CSS preprocessor support

Available Commands

Production Build

Copied!
Shell
npm run build

Creates optimized, minified production-ready assets:

Development Build

Copied!
Shell
npm run build:dev

Creates unminified development assets:

Development Watch Mode

Copied!
Shell
npm run dev

Starts Webpack in watch mode:

Press Ctrl + C to stop the watcher.

Build Output

Compiled assets are placed in the src/Blocks/ directory (gitignored; run npm run build after clone):

Copied!
Directory tree
src/Blocks/├── countdown/├── slider/├── slide/├── toggle/├── toggle-content/├── related-posts/└── blocks-manifest.php

Asset PHP Files

Each compiled JavaScript file generates a companion .asset.php file:

Copied!
PHP
<?php return array( 'dependencies' => array('wp-element', 'wp-blocks', 'wp-i18n'), 'version' => 'abc123def456',);

This file declares WordPress script dependencies and provides a version hash for cache busting. WordPress uses this during wp_enqueue_script().

Source File Structure

Block source files live in src/Blocks/:

Copied!
Directory tree
src/Blocks/├── countdown/│ ├── block.json│ ├── index.tsx│ ├── edit.tsx│ └── view.ts├── slider/├── slide/├── toggle/├── toggle-content/└── related-posts/

Video editor assets are built in the Aegis Video add-on.

Webpack Configuration

Aegis extends the default @wordpress/scripts Webpack config. Entries from block.json file:index.js / file:view.js are remapped to index.tsx / view.ts when those sources exist, then emitted in place under src/Blocks/.

The default configuration handles:

CSS Processing

CSS files are processed through PostCSS with the following plugins:

PluginPurpose
AutoprefixerAdds vendor prefixes for browser compatibility
postcss-importAllows @import statements
cssnano (production)Minifies CSS output

Writing CSS

Aegis stylesheets use standard CSS with CSS custom properties:

Copied!
CSS
.wp-block-aegis-countdown { display: flex; gap: var(--wp--preset--spacing--md); font-family: var(--wp--preset--font-family--lexend-deca);}

JavaScript Processing

JavaScript is compiled through Babel with WordPress presets:

Writing JavaScript

Block scripts use WordPress packages as externals:

Copied!
JavaScript
import { registerBlockType } from '@wordpress/blocks';import { useBlockProps } from '@wordpress/block-editor';registerBlockType( 'aegis/countdown', { edit: Edit, save: Save,} );

Cleaning Build Output

To remove all compiled assets:

Copied!
Shell
npm run clean

Or manually delete compiled files under src/Blocks/ (see .gitignore).

Environment Variables

VariablePurposeDefault
NODE_ENVBuild modeproduction (build) / development (dev)
SCRIPT_DEBUGWordPress debug modeLoads unminified assets

Troubleshooting

Build Fails with Module Errors

Copied!
Shell
rm -rf node_modulesnpm installnpm run build

Stale Build Output

Copied!
Shell
npm run cleannpm run build

Watch Mode Not Detecting Changes

Translations

The theme catalog is languages/aegis.pot (text domain aegis). It does not include Aegis Dash strings.

Copied!
Shell
cd wp-content/themes/aegisnpm run translate # Requires `wp` on PATHnpm run translate:studio # WordPress Studio

prepare-translate.js copies vendored Icon, Marquee, Newsletter, Accordion, SVG, Visibility, and Query Loop sources into build/I18nScan for the scan (vendor/ is excluded). Bundled editor.js is not scanned; live SVG inspector strings come from svg-editor.js. WP-CLI scans JavaScript, not TypeScript, so run npm run build first if you changed theme block *.tsx / *.ts sources (for example src/Blocks/slider/edit.tsx, countdown/edit.tsx, toggle/index.tsx, related-posts/edit.tsx). Plugin strings belong in wp-content/plugins/aegis-dash/languages/aegis.pot. Pro strings belong in wp-content/plugins/aegis-pro/languages/aegis-pro.pot. See Aegis Dash Building Assets and Development Tools.

Next Steps