composer install
npm install
The plugin uses modern JavaScript (ES6+) and SCSS, which need to be compiled before use.
# Build production assets (minified)
npm run build:assets
# Development mode with watch (auto-rebuild on file changes)
npm startSource files: resources/js/ and resources/css/
Built files: build/ (gitignored, auto-generated)
npm run wp-env start
wp-env clean development
wp-env clean tests
# Run all tests
npm run tests:e2e
# Run a test file
npm run tests:e2e 01-pdf-generation.spec.js
# Run a single test
npm run tests:e2e -- -g "HTML output uses archive template for shop page"
# Generate screenshot in test for debugging
await page.screenshot({ path: 'test-results/screeshot.png', fullPage: true });
npm run tests:unit
npm run tests:integration
wp-env run cli --env-cwd=wp-content/plugins/dk-pdf composer
- Install dependencies:
npm install && composer install - Start development mode:
npm start(watches for file changes) - Edit source files:
- JavaScript:
resources/js/ - CSS/SCSS:
resources/css/
- JavaScript:
- Files auto-compile to
build/directory - Run tests before committing
# Full production build (includes asset compilation)
npm run build
# Asset compilation only
npm run build:assetsJavaScript:
- Modern ES6+ with vanilla JavaScript (no jQuery)
- Modular structure with ES modules
- Native Fetch API for AJAX requests
- Built with webpack via
@wordpress/scripts
CSS:
- SCSS with modern
@usesyntax - CSS variables for theming
- Modular component structure
- Auto-generated RTL stylesheets
- Autoprefixed for browser compatibility
Third-party libraries (kept as-is):
- Select2 for enhanced dropdowns
- Farbtastic for color picker
- ACE Editor for CSS editing