HumHub Build
HumHub provides some grunt tasks to ease the execution of some console commands. This guide describes how to setup grunt and run these commands. All grunt tasks need to be run within your HumHub root.
Setup Grunt
npm install -g grunt-cli
- call
npm install
in your HumHub root
Build production assets
HumHub uses Yii`s build-in mechanism for compressing and combining assets as javascript or stylesheet files in combination with grunt. Those compressed assets are only used when running in production mode and in acceptance tests. When running in debug mode, separate assets files are used to ease development and debugging.
When running a development environment, you'll have to manually build those
production assets in order to run acceptance tests (or testing the production mode). The production build will compress
scripts and stylesheets configured in humhub\assets\AppAsset
into the following files:
@humhub/static/js/all-*.js
@humhub/static/css/all-*.css
Grunt based build
The simples way to build your production assets is by running the following grunt task:
grunt build-assets
Manual build
- Delete the content of your
static/assets
directory. - Delete the old compressed file
@humhub/static/js/all-*.js
and@humhub/static/css/all-*.css
- Run the following command within your
protected
directory:
php yii asset humhub/config/assets.php humhub/config/assets-prod.php
Refer to the Yii Asset Guide for more information.
Build themes
HumHub themes consist of many less files within the /less
directory of a theme. The grunt build-theme
task can be used
to build the community theme or other themes residing in the @humhub/themes
directory. For this command you'll need to
install Less:
npm install less less-plugin-clean-css -g
Build community theme
To rebuild the community theme run:
grunt build-theme
Build custom themes
To build another theme residing in the @humhub/themes
directory run:
grunt build-theme --name=MyTheme
Refer to the Theming Guide for more information about custom themes.
Manual theme build
To build a theme without grunt, run the following command:
lessc --clean-css themes/HumHub/less/build.less themes/HumHub/css/theme.css
Search index rebuild
Grunt task for rebuilding your Search Index
grunt build-search
Run migration
Grunt task for running database migrations.
The following command will run the migration for core and modules:
grunt migrate-up
Run core migrations only:
grunt migrate-up --module=0
Testing
Run test server:
grunt test-server
Run tests:
grunt test
See Testing Guide for more use cases of the grunt test
task.