aminroosta / deriv-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deriv App

This repository contains the static HTML, Javascript, CSS, and images content of the Deriv website.

Installation

In order to work on your own version of the Deriv Javascript and CSS, please fork this project.

You will also need to install the following on your development machine:

Use a custom domain

In order to use your custom domain, please put it in a file named CNAME inside scripts folder of your local clone of binary-static.

How to work with this project

Deploy to your gh-pages for the first time

  1. Register your application here. This will give you the ability to redirect back to your github pages after login. Use https://YOUR_GITHUB_USERNAME.github.io/deriv-app/ for the Redirect URL and https://YOUR_GITHUB_USERNAME.github.io/deriv-app/en/redirect for the Verification URL.

    If you're using a custom domain, replace the github URLs above with your domain.

  2. In src/javascript/config.js: Insert the Application ID of your registered application in user_app_id.

  • NOTE: In order to avoid accidentally committing personal changes to this file, use git update-index --assume-unchanged src/javascript/config.js
  1. Run grunt dev

Deploy js/css and template changes together

grunt dev

Deploy only js/css changes

grunt deploy

Deploy some template changes

grunt dev --path=about-us

Using sub-folders

There are times that you are working on various branches at the same time, and you want to deploy/test each branch separately on your gh-pages, you can simply use --branch=branchname for grunt commands:

Important: Note that you can use the same app ID created above for all your branches. There is no need to create multiple app IDs for each branch.

In order to remove the created folders from your gh-pages, you can use either:

  • grunt dev --cleanup: removes all br_* folders and deploys to the root folder.

    or

  • grunt shell:remove_folder --folder=br_branchname1,br_branchname2,...: only removes the specified folder(s) from your gh-pages.

    or

  • grunt shell:remove_folder --keep --folder=br_branchname1,br_branchname2,...: only keeps the specified folder(s) on your gh-pages and removes everything else. Just add the --keep flag.

Preview on your local machine

  • Edit your /etc/hosts file to include this domain:
127.0.0.1   localhost.binary.sx
  • To preview your changes locally for the first time, run grunt start:
    • It will compile all templates, css, and js as well as watch for further js/css changes and rebuild on every change you make.
  • To preview your changes locally without re-compiling any css/js/templates run grunt serve
    • It will watch for js/css changes and rebuild on every change you make.
  • To test changes made to templates, you need to re-compile them:
    • grunt shell:compile_dev to re-compile all templates.
    • grunt shell:compile_dev --path=about-us to re-compile only template(s) which serve about-us path in URL.
  • To fix eslint errors run npm run eslint

Release

grunt release --{release type}=1 [--cleanup] [--reset]

(The value is needed when more than one option is used)

Parameters:

  • {release type} (mandatory)
    • Should be one of staging, production, translations.
    • In order to prevent accidentally releasing to the wrong target, it is mandatory to provide one of these parameters.
    • Your remote origin will be checked to be the correct target of the given parameter.
    • Your current branch will be checked to be the correct branch of the given parameter.
  • --cleanup [optional]
    • Create CNAME file with proper value according to remote origin
    • Deploy to gh-pages with the option add: false
  • --reset [optional]
    • Removes all commits from gh-pages branch before release (staging only)

About

License:Apache License 2.0


Languages

Language:JavaScript 83.2%Language:CSS 15.8%Language:HTML 0.8%Language:Shell 0.1%