CLI Commands (AssetBundle)

oro:assets:build

The oro:assets:build command runs bin/webpack to build the web assets in all themes.

php bin/console oro:assets:build

The assets can be build only for a specific theme if its name is provided as an argument:

php bin/console oro:assets:build <theme-name>
php bin/console oro:assets:build default
php bin/console oro:assets:build blank
php bin/console oro:assets:build admin.oro

With --env=dev, the assets are built without minification and with source-maps, while with --env=prod, the assets are minified and do not include source-maps:

php bin/console oro:assets:build --env=dev

or

php bin/console oro:assets:build --env=prod

The --watch (-w) option can be used to continuously monitor all resolved files and rebuild the necessary assets automatically when any changes are detected:

php bin/console oro:assets:build --watch

or

php bin/console oro:assets:build -w

Note

When using the --watch, option you should restart the command after you modify the assets configuration in assets.yml files, or it will not be able to detect the changes otherwise.

The --hot option turns on the hot module replacement feature. It allows all styles to be updated at runtime without the need for a full page refresh:

php bin/console oro:assets:build --hot

The --key, --cert, --cacert, --pfx and --pfxPassphrase options can be used with the --hot option to allow the hot module replacement to work over HTTPS:

php bin/console oro:assets:build --hot --key=<path> --cert=<path> --cacert=<path> --pfx=<path> --pfxPassphrase=<passphrase>

The --force-warmup option can be used to warm up the asset-config.json cache:

php bin/console oro:assets:build --force-warmup

The --npm-install option can be used to reinstall npm dependencies in vendor/oro/platform/build folder. It may be required when node_modules contents become corrupted:

php bin/console oro:assets:build --npm-install

The --skip-css, --skip-js, --skip-babel, --skip-sourcemap and --skip-rtl options allow to skip building CSS and JavaScript files, skip transpiling Javascript with Babel, skip building sourcemaps and skip building RTL styles respectively:

php bin/console oro:assets:build --skip-css
php bin/console oro:assets:build --skip-js
php bin/console oro:assets:build --skip-babel
php bin/console oro:assets:build --skip-sourcemap
php bin/console oro:assets:build --skip-rtl

The --analyze option can be used to run BundleAnalyzerPlugin:

php bin/console oro:assets:build --analyze

oro:assets:install

The oro:assets:install command installs and builds assets, dumps JavaScript routes, JavaScript translations, etc.

php bin/console oro:assets:install

If the --symlink option is provided this command will create symlinks instead of copying the files (it may be especially useful during development):

php bin/console oro:assets:install --symlink

You may run individual steps if necessary as follows:

php bin/console fos:js-routing:dump
php bin/console oro:localization:dump
php bin/console assets:install [--symlink]
php bin/console oro:assets:build --npm-install

The --force-debug option will launch the child commands in the debug mode (be default they are launched with --no-debug):

php bin/console oro:assets:install --force-debug other options

The --timeout option can be used to limit execution time of the child commands:

php bin/console oro:assets:install --timeout=<seconds> other options