|
| 1 | +# blÖcks REDAXO Addon |
| 2 | + |
| 3 | +Always follow these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here. |
| 4 | + |
| 5 | +blÖcks is a REDAXO CMS addon that adds features to content modules including drag & drop reordering, cut & copy functionality, and online/offline status management. The addon uses a Node.js/Grunt build system for frontend asset compilation. |
| 6 | + |
| 7 | +## Working Effectively |
| 8 | + |
| 9 | +### Initial Setup |
| 10 | +- Bootstrap the development environment: |
| 11 | + - Node.js v20+ and npm are pre-installed |
| 12 | + - Run `npm install` -- takes ~35 seconds, may show vulnerabilities that don't affect functionality |
| 13 | + - Grunt CLI is pre-installed globally |
| 14 | + |
| 15 | +### Build Process |
| 16 | +- **Development build with watch mode:** |
| 17 | + - `grunt` -- NEVER CANCEL: runs build then starts watch mode indefinitely. Use Ctrl+C to stop when done. |
| 18 | + - Processes LESS → CSS, concatenates/uglifies JS, syncs assets to correct directories |
| 19 | + - Watch mode automatically rebuilds when source files change |
| 20 | + |
| 21 | +- **Production build:** |
| 22 | + - `grunt --production` -- takes ~2 seconds, NEVER CANCEL: Set timeout to 30+ seconds |
| 23 | + - Compresses CSS, uglifies JS, generates distribution-ready assets |
| 24 | + - Does not include source maps |
| 25 | + |
| 26 | +### Asset Synchronization |
| 27 | +- `./rsync.sh` -- takes <1 second |
| 28 | + - Syncs compiled assets from individual plugin directories to main assets directory |
| 29 | + - Uses rsync.exclude file to filter files |
| 30 | + - Required after manual asset changes |
| 31 | + |
| 32 | +### Release Management |
| 33 | +- **Version updates:** |
| 34 | + - `./version.sh "4.0.3"` -- DOES NOT WORK on Linux (macOS-specific sed syntax) |
| 35 | + - Updates version numbers in .php and .yml files |
| 36 | + - Document this limitation: "version.sh script fails on Linux due to macOS-specific sed syntax" |
| 37 | + |
| 38 | +- **Create release package:** |
| 39 | + - `./zip.sh` -- takes ~2 seconds, NEVER CANCEL: Set timeout to 30+ seconds |
| 40 | + - Runs production build first, then creates zip file in parent directory |
| 41 | + - Excludes development files (node_modules, assets_src, .git, etc.) |
| 42 | + - Creates bloecks.zip ready for REDAXO installer |
| 43 | + |
| 44 | +## Validation |
| 45 | + |
| 46 | +### Build Validation |
| 47 | +- Always run `grunt --production` after making changes to verify assets compile correctly |
| 48 | +- Check that files are created in assets/css/ and assets/js/ directories |
| 49 | +- Verify plugin assets are synced to correct locations after rsync |
| 50 | + |
| 51 | +### Manual Testing Scenarios |
| 52 | +- This is a backend-focused addon - no frontend UI to test |
| 53 | +- Verify that build process completes without errors |
| 54 | +- Check that all LESS files compile to CSS without syntax errors |
| 55 | +- Confirm JavaScript files concatenate and uglify properly |
| 56 | + |
| 57 | +## File Structure & Navigation |
| 58 | + |
| 59 | +### Key Directories |
| 60 | +- `/lib/` - Core PHP classes (bloecks_abstract, bloecks_backend, Bloecks) |
| 61 | +- `/assets_src/` - Source files for compilation (LESS, JS) |
| 62 | +- `/assets/` - Compiled output files (CSS, JS) |
| 63 | +- `/plugins/cutncopy/` - Cut & copy functionality plugin |
| 64 | +- `/plugins/dragndrop/` - Drag & drop reordering plugin |
| 65 | +- `/pages/` - Admin interface pages |
| 66 | +- `/lang/` - Translation files |
| 67 | + |
| 68 | +### Important Files |
| 69 | +- `package.yml` - Addon metadata and dependencies |
| 70 | +- `boot.php` - Addon initialization |
| 71 | +- `Gruntfile.js` - Build configuration |
| 72 | +- `package.json` - Node.js dependencies |
| 73 | +- `README.developers.md` - Development documentation (German) |
| 74 | + |
| 75 | +### Asset Processing |
| 76 | +- Source files in `**/assets_src/less/be.less` → compiled to `**/assets/css/be.css` |
| 77 | +- Source files in `**/assets_src/js/be/**/*.js` → concatenated to `**/assets/js/be.js` |
| 78 | +- Frontend files follow same pattern with `fe.less` and `fe/` directory |
| 79 | +- Plugin assets follow same structure within their directories |
| 80 | + |
| 81 | +## Common Tasks |
| 82 | + |
| 83 | +The following are validated commands and their expected outputs: |
| 84 | + |
| 85 | +### Install Dependencies |
| 86 | +```bash |
| 87 | +npm install |
| 88 | +# Takes ~35 seconds |
| 89 | +# Shows deprecation warnings and 14 vulnerabilities - these don't affect functionality |
| 90 | +# Use timeout of 60+ seconds |
| 91 | +``` |
| 92 | + |
| 93 | +### Development Build |
| 94 | +```bash |
| 95 | +grunt |
| 96 | +# Compiles assets then starts watch mode |
| 97 | +# Initial build takes ~2 seconds, then waits for file changes |
| 98 | +# Stop with Ctrl+C when done |
| 99 | +# NEVER CANCEL: Set timeout to indefinite for watch mode |
| 100 | +``` |
| 101 | + |
| 102 | +### Production Build |
| 103 | +```bash |
| 104 | +grunt --production |
| 105 | +# Takes ~2 seconds |
| 106 | +# Outputs: "Done." |
| 107 | +# Creates minified, production-ready assets |
| 108 | +# NEVER CANCEL: Set timeout to 30+ seconds |
| 109 | +``` |
| 110 | + |
| 111 | +### Create Release |
| 112 | +```bash |
| 113 | +./zip.sh |
| 114 | +# Takes ~2 seconds total (includes grunt --production) |
| 115 | +# Creates ../bloecks.zip file ready for distribution |
| 116 | +# NEVER CANCEL: Set timeout to 30+ seconds |
| 117 | +``` |
| 118 | + |
| 119 | +### Sync Assets |
| 120 | +```bash |
| 121 | +./rsync.sh |
| 122 | +# Takes <1 second |
| 123 | +# No output on success |
| 124 | +``` |
| 125 | + |
| 126 | +## Repository Information |
| 127 | + |
| 128 | +### Technology Stack |
| 129 | +- **Backend:** PHP 7+ (REDAXO CMS addon) |
| 130 | +- **Frontend Build:** Node.js, Grunt, LESS, UglifyJS |
| 131 | +- **Asset Management:** rsync for directory synchronization |
| 132 | + |
| 133 | +### Dependencies |
| 134 | +- REDAXO ^5.5.0 |
| 135 | +- PHP >=7 |
| 136 | +- structure/content ^2.1.0 |
| 137 | +- Node.js for build system |
| 138 | + |
| 139 | +### Plugin Architecture |
| 140 | +- `cutncopy` - Copy and paste content blocks between articles |
| 141 | +- `dragndrop` - Drag and drop reordering of content blocks |
| 142 | +- Status management was deprecated in v3.0.0 (now in REDAXO core) |
| 143 | + |
| 144 | +Always run production builds and asset sync after making changes to ensure compatibility with the REDAXO addon system. |
0 commit comments