NodeBB requires a build step before it can run and serve pages to end users. This build process can be
manually invoked by running
./nodebb build. However, as the build process itself can take a long time
depending on your particular computer specifications, there are other strategies to optimize the
development process. The same strategies can be used if you are developing plugins and themes.
Selective building of assets
If you only need to build a specific part of NodeBB,
./nodebb build can take space-separated arguments
to limit its scope.
For example, if you are making changes to your plugin's administrative pages, you can elect to build:
./nodebb build adminjs admincss tpl
The full list is can be found in the codebase itself.
For optimized development, the NodeBB team (and many of the plugin authors) use Grunt
as part of their workflow. The pre-requisite dependencies are installed with NodeBB during the
step, although you may need to install
grunt-cli (or your distribution's appropriate package for grunt)
grunt to be called via the command line.
Once installed, you can simply run
grunt to build all assets and run NodeBB. Grunt will also watch for
file changes and selectively build a subset of NodeBB's assets so there is no need to hop back to the
console to stop NodeBB, build, and restart NodeBB.
Alternatively, you can run
grunt --skip, which skips the build step and simply runs NodeBB with file
Accessing page data
Each page in NodeBB is rendered using json data. You can view this data by prepending
/api to the url. For example if you are on the
/recent page you can navigate to
/api/recent to see the corresponding json data. When NodeBB is started in production mode the json output will not have any formatting so it will be hard to read, to prettify it you can add ?pretty=1 to the url.