franklingu Hi, I wonder if it is possible to add some flag or some setting to update so that I can have more debug information when I am developing an extension locally?
Franz franklingu Hi there. This is a great discussion to have. What kind of debug information are you looking for? (You do have debug mode turned on in config.php, right?)
franklingu Franz One more question not related to this topic but keep to know: how do I recompile assets when I change something in extension?
franklingu Franz I just saw the huge stacktrace... something went wrong with my code. my prev question remains
franklingu I am just starting getting familiar with php and flarum--and babel. so maybe I am still quite lost. but like from Django || Rails(especially) experience, I would be able to see many logs in dev and even stacktrace when something breaks.
franklingu The localhost page isn’t working localhost is currently unable to handle this request. 500 so when I do js request to backend and find this, logging with what went wrong maybe a lot helpful
luceos Hi franklingu debugging PHP is mainly done by: setting debug to true in config.php. watching your error log files of the site (or webserver). debugging JS/frontend is somewhat more complex and can be done by: opening your browser developer tools (in chrome f12) and checking the console tab. using this console tab interactively, try it out on these forums by typing app in that screen and pressing enter. using console.log() at places to dump code at certain brake points. You might want to read https://discuss.flarum.org/d/1662-extension-developer-first-read Related to your compilation question, all JS of Flarum is compiled using Gulp, this is available through NPM the node package manager. Every time you make changes to the JS of your extension you will need to manually run gulp in the js/forum or js/admin directories to recompile the js-files in the assets directory.
Franz luceos Every time you make changes to the JS of your extension you will need to manually run gulp in the js/forum or js/admin directories to recompile the js-files in the assets directory. In fact, if you run gulp watch, it will keep watching the source JS files for changes and automatically recompile them for you. ?
franklingu luceos I am still a bit confused. so if I run gulp inside that directory, the JS in js/src is going to compiled do dist right? but how does that get collected and compiled into forum-*.js in the outer most assets directory?
Franz franklingu Flarum does that by collecting the assets that were registered by extensions (example), and concatenates them together. It will do that automatically for you.