Sign inSign up

bookunited/blurr

By bookunited

Updated 5 days ago

The blurr base image

Image
0

100K+

bookunited/blurr repository overview

Blurr

Coding standards

Refer to the coding-standards document for the PHP/JS/CSS coding standards for this project.

Getting Blurr to work (clean install)

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.

Clone the repository
git clone -b develop [email protected]:travver/blurr.git
Build/download the docker images
develop build
Install the required composer dependencies
develop composer install
Copy the .env.example file to a new .env file, then update the file with the correct values (ask a colleague) and set the app key
cp .env.example .env
develop artisan key:generate
Install npm dependencies
develop npm install
Run the webpack command to generate the assets:
develop webpack development
Start the docker container(s)
develop up -d

Now you should have a working instance of Blurr running that you can visit on http://localhost/ and https://localhost/

Partners / brands

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'.

Creating a new partner

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

Default partner folder structure

Partner-specific code is generated in the brands/{namespace}/ folder in the project. By default, this folder contains the following files:

FileDescription
App/Boot.phpThe boot file for the partner, which allows you to load partner specific files and services
App/Http/routes.phpContains partner specific routes
resources/assets/config.jsonThe configuration file for the default vue components
resources/assets/logo.pngLogo (preferably 256x256 pixels) that is used for icon generation (replace with the actual partner logo)
resources/assets/images/header-logo.pngDefault header logo. Replace with the partner logo when using the default header
resources/assets/scss/brand.scssThe sass entrypoint, loads the default stylesheets
resources/assets/scss/_variables.scssThe preferred location to override default variables
webpack.mix.jsThe webpack mix file

Referencing partner-specific information in the code

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');

Configuring vue components

Immutable brand configuration

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:

FileDescription
components/map/config.jsonConfiguration for the map view icons
components/offer/config.jsonConfiguration for the offer lists (amount to show, usps to show, sense of urgency)
components/search/autocomplete/config.jsonConfiguration of the main search path for the autocompleter
components/search/filter/config.jsonConfiguration of the search filters for the resultpage
components/search/list/config.jsonConfiguration for the resultpage

All variables are accessible with under the config in every Vue component

this.$config.get('SearchList.Amount')

overrides

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

Dynamic component configuration

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.

export configuration

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.

Content pages

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.

Develop command

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

Docker commands

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

Running special develop commands

Artisan

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.

Composer

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.

PHPUnit

To run PHPUnit tests, use develop phpunit. This will run all tests using the phpunit version installed through composer in the blurr container.

NPM

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.

Webpack

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:

  • PurifyCSS (to remove redundant css code)
  • URL processing for SCSS files
  • The Favicons plugin that generates various icons
  • The MergeJson plugin that combines json configuration files
  • The Stylelint plugin that checks css code
  • The PostCSS BEM linter that checks css for valid BEM style
  • The grid prefixes for the autoprefixer

Tag summary

Content type

Image

Digest

sha256:34017f03e

Size

271.7 MB

Last updated

5 days ago

docker pull bookunited/blurr:641dd65115a5dcf4e149cdc0a7a54b1bfb8ffeaa