Figured it out but got stuck at the Gulp part.
I followed the tutorial http://flarum.org/docs/extend/start/
Is that part up-to-date or did I mess up?
Ran the npm install and gulp watch command...
C:\xampp\htdocs\flarum\workbench\flarum-ext-helloworld\js\forum>gulp watch
[23:26:31] Using gulpfile C:\xampp\htdocs\flarum\workbench\flarum-ext-helloworld\js\forum\gulpfile.js
[23:26:31] Starting 'default'...
[23:26:31] Finished 'default' after 30 ms
[23:26:31] Starting 'watch'...
[23:26:31] Finished 'watch' after 6.48 ms
...the dist/extension.js was not generated.
bootstrap.php:
<?php
use Flarum\Event\ConfigureClientView;
$events->listen(ConfigureClientView::class, function (ConfigureClientView $event) {
if ($event->isForum()) {
$event->addAssets(__DIR__.'/js/forum/dist/extension.js');
$event->addBootstrapper('koat/flarum-ext-helloworld/main');
}
});
composer.json
{
"name": "koat/flarum-ext-helloworld",
"description": "Say hello to the world!",
"type": "flarum-extension",
"require": {
"flarum/core": "^0.1.0-beta.6"
},
"extra": {
"flarum-extension": {
"title": "Hello World"
}
}
}
js/forum/gulpfile.js
var flarum = require('flarum-gulp');
flarum({
modules: {
'koat/flarum-ext-helloworld': [
'src/**/*.js'
]
}
});
js/forum/package.json
{
"private": true,
"devDependencies": {
"gulp": "^3.8.11",
"flarum-gulp": "^0.1.0"
}
}
js/forum/main.js
app.initializers.add('koat-helloworld', function() {
alert('Hello, world!');
});