| assets | ||
| content-templates | ||
| dist | ||
| page-templates | ||
| src | ||
| .gitignore | ||
| 404.php | ||
| composer.json | ||
| composer.lock | ||
| custom-functions.php | ||
| footer.php | ||
| front-page.php | ||
| functions.php | ||
| header.php | ||
| index.php | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.js | ||
| README.md | ||
| screenshot.png | ||
| searchform.php | ||
| style.css | ||
| svgo.config.js | ||
| webpack.config.js | ||
RDNYC WordPress Bootstrap 5/PurgeCSS Theme
The WordPress theme for recoverydharma.org, based on Webpack 5, Bootstrap 5, and some development conveniences.
Originally forked from WP 73k, itself forked from WP Tailwind
Development Requirements
How to get started
- Clone or download the project into your
themesdirectory (./wp-content/themes) - Run
composer install - Run
npm install - Set environment variables for BrowserSyncPlugin to the domain/ports you need (see
webpack.config.jsfor variables needed). - Run
npm run startto begin development server,npm run devfor simple dev build,npm run prodfor a production build, ornpm run buildto build both dev & prod concurrently.
SVGs
Optimization
Images placed in assets/images will be copied to dist/images -- however, SVGs can be optimized by placing them in assets/raw and importing them in main.js, e.g.:
import '../raw/rdnyc-logo.svg';
This will output an optimized version to dist/images
SVG icons can be pulled into a sprite file (output to dist/images/icon-sprites.svg). For this to work, @import them in main.js (see examples). Sprite names are set by the config in webpack.config.js with prefixes supported for some icon packs (@mdi/svg, bootstrap-icons, heroicons). They can then be used for menus (put icon-<PREFIX>-<ICON-NAME> in the class for a menu item), or used in the theme php files with the svg_icon_use($icon_name, $div_class) function from custom-functions.php to get a div containing the correct svg use tag. $div_class should usually include baseline for proper layout.
Including
SVG images can be implemented two ways:
- A normal
<img src="<?php echo get_template_directory_uri() . '/dist/images/svg-roll-mandala.svg'; ?>" ... >tag- This cannot be colored but preserves SVG styling
- Since resource is loaded separately, it can be cached.
- An inline SVG using the
inline_svg( $svg_name, $atts )function incustom-functions.php-- see that file for supported$attsarray keys.- This can be colored from parent element
- SVG class requires
{{class-placeholder}}for 'svg_class'$attskey to work - Since resource is inline, cannot be cached.