Skip to main content
page last edited on 17 January 2023

Installation of Resources (js, css, images)

Version: 5.5

Introduction

Since resources (js, css, images) are stored separately in the core and in the modules, and - in addition to that - since for modules there exists an option of replacement of resources of the core or of other modules, some tools have been provided for resource installation.

Resources get installed in the public/assets folder.

assets:install

For the installation of resources from 3rd party bundles, the standard routine is used. The installation is done automatically during the installation of X-Cart or during the installation, removal or activation/deactivation of modules.

Manually it is launched using the following command:

php ./bin/console assets:install

xcart:assets:install

For the installation of XCart resources and modules, a special command is provided. It is executed automatically the same way as assets:install . The command is implemented in such a way that if a module replaces a resource of the core or of another module, then only the working file is copied to the public/assets folder.

gulp install

It is an alternative for xcart:assets:install ; functionally it does the same thing as xcart:assets:install, but in addition to that, it also does js minification and has a watch mechanism, which means it can automatically track changes in source files and can automatically copy them to public/assets if necessary.

To use it, you need to:

yarn global add gulp-cli

After that it is necessary to set the dependencies.

yarn

Available commands:

gulp install - is analogous to the php ./bin/console xcart:assets:install command but when it is used, minified versions of js files are also created

gulp minify - creates minified versions of js files in public/assets

gulp watch - starts the tracking of changes in the resource sources in the core and modules and the automatic copying to public/assets