Refer to the coding-standards document for the PHP/JS/CSS coding standards for this project.
Prerequisites when running Windows:
Prerequisites when running Mac OSX:
Note: Using Docker ensures that the code is run in the exact same environment on development, staging, acceptance and production servers.
This means that all commands used during development to generate assets, run commands or create new files should be run in the docker container as well.
To make running these commands a little easier, a 'develop' command has been created for both Windows and Mac machines. Windows users should use 'develop.bat', Mac users should use 'develop.sh'. The command will be referred to as develop in these instructions. For more information, check out the develop command documentation.
git clone -b develop [email protected]:travver/blurr.git
develop build
develop composer install
cp .env.example .env
develop artisan key:generate
develop npm install
develop webpack development
develop up -d
Now you should have a working instance of Blurr running that you can visit on http://localhost/ and https://localhost/
Blurr is built to host multiple websites that all connect to the same backend API. Each website is referred to as a 'partner' or a 'brand'.
To create a new partner, simply run the following command which will interactively help you create a new partner.
This will create the files as well as add an entry into the database.
develop artisan partners:create
Partner-specific code is generated in the brands/{namespace}/ folder in the project. By default, this folder contains the following files:
| File | Description |
|---|---|
| App/Boot.php | The boot file for the partner, which allows you to load partner specific files and services |
| App/Http/routes.php | Contains partner specific routes |
| resources/assets/config.json | The configuration file for the default vue components |
| resources/assets/logo.png | Logo (preferably 256x256 pixels) that is used for icon generation (replace with the actual partner logo) |
| resources/assets/images/header-logo.png | Default header logo. Replace with the partner logo when using the default header |
| resources/assets/scss/brand.scss | The sass entrypoint, loads the default stylesheets |
| resources/assets/scss/_variables.scss | The preferred location to override default variables |
| webpack.mix.js | The webpack mix file |
Get the partner object through a function.
partner();
Get specific partner setting.
partner()->setting('partner.name');
Get a partner asset from the mix manifest.
partner()->mix('filename.ext');
Get an unversioned partner asset.
partner()->file('filename.ext');
These settings are global for every brand and not page specific. To adjust the behaviour of various vue components you can add settings to the config.json file of the partner found in resources/assets/config.json. You can reference these files (in resources/whitelabel/assets/js/) for the available options and their default values:
| File | Description |
|---|---|
| components/map/config.json | Configuration for the map view icons |
| components/offer/config.json | Configuration for the offer lists (amount to show, usps to show, sense of urgency) |
| components/search/autocomplete/config.json | Configuration of the main search path for the autocompleter |
| components/search/filter/config.json | Configuration of the search filters for the resultpage |
| components/search/list/config.json | Configuration for the resultpage |
All variables are accessible with under the config in every Vue component
this.$config.get('SearchList.Amount')
To override the default setting for a brand you add a config file in /brands/{brandname}/resources/assets/js/{component}/config.json When building the main config file these settings are merged for a brand
To create a menu in the backend for a component you need a (componentname).json file in the same directory as the vue component. This menu structure is used by the backend to create menu which can populate the dynamic settings of the component. Think about header text, or custom queries for product listings. These settings are injected at runtime, and are available in the components data section of the vue file. Make sure the data property exist that the componentSettings mixin is used.
You can import and export all dynamic configuration in the backend of blur, in the content section. This allows you to copy the production environment for use in development.
The homepage, content pages like contact, faq etc and custom pages are managed by the content section in the admin. You can manage the text and the various components with their settings. You can build for example a custom homepage by using a configurable list of components. Every partner gets his own set of pages based on a languages with the use of default content. You can find this content in the md files located in /resources/whitelabel/views/content/pages.
The develop command (develop.bat for Windows systems, develop.sh for Mac OSX systems) has been created to make dealing with the docker containers a bit easier.
By default (without any parameters) the develop command runs docker-compose ps using the development docker-compose file (docker-compose.dev.yml). This lists the running docker containers.
When supplied by a parameter that is not listed below, the command will run docker-compose using the development docker-compose file and add the parameters added to the command. For example, to run a bash shell in the blurr container, use:
develop run --rm blurr bash
Using docker you can build, run, inspect and destroy docker images and containers. Here you will find a list of regularly used commands. To check out the available commands and options, check out the docker-compose reference docs.
Building the images from the docker compose file (use the --no-cache flag to force a full rebuild`):
develop build
Starting the docker containers (use the -d flag to detach after starting the containers):
develop up
Stopping the docker containers (use the -v flag to remove created volumes if required):
develop down
To run artisan commands, use develop artisan. This will run artisan in the blurr container. So to run migrations use develop artisan migrate, to create a new event run develop artisan make:event etc.
To install or update composer dependencies, use the develop composer command. This will run composer in the blurr container, ensuring that the correct dependencies are installed. To install use develop composer install, to add a package use develop composer require developer/package, etc.
To run PHPUnit tests, use develop phpunit. This will run all tests using the phpunit version installed through composer in the blurr container.
To install or update nodejs dependencies, use develop npm. This will run npm in the node container. To install the depencies run develop npm install, to install a new dependency use develop npm install <package> --save, etc.
Use the webpack command to compile the assets. Using the develop webpack command will run webpack in the node container.
The webpack command accepts 2 extra parameters: develop webpack <command> <namespace> that accept the following values:
command should be replaced by development to run a development build, production to run a production build, or watch to watch the assets and update the development build when a file is changed. When the argument is not supplied, production is used.
namespace is optional and can be used to specify the namespace of a specific partner that should be compiled or watched. To make webpack watch the files of the Hoteldeal partner, use develop webpack watch Hoteldeal.
The -f flag can be prepended to speed up the build: develop webpack -f <command> <namespace>
This runs only a part of the webpack build, it excludes:
Content type
Image
Digest
sha256:34017f03e…
Size
271.7 MB
Last updated
5 days ago
docker pull bookunited/blurr:641dd65115a5dcf4e149cdc0a7a54b1bfb8ffeaa