User Tools

Site Tools


tdk:setup

Setup the Theme Development Kit

Create a new project

Using Composer

Use the following command to create a new project called my-theme

  composer create-project a3gz/i2go-theme-template my-theme -s dev

If we are working on an older PHP version such as 5.6 we can use the following command instead to avoid issues with some dependencies:

  composer create-project a3gz/i2go-theme-template:dev-php56 my-theme -s dev

When Composer asks if we want to remove the `.git` directory, we type y and hit [ENTER].

Clone the repository

If for whatever reason you don't have Composer installed in your computer, for instance if you only work within Docker containers, then you can clone the repository.

  git clone --depth=1 --branch=master https://gitlab.com/jti-card-themes/i2go-theme-template.git my-theme

If we cloned the repository we'll have to manually remove VCS files, which in this case exist under a directory called .git

  Linux:  rm -rf my-theme/.git
  
  Windows PowerShell: rm my-theme/.git -Force -Recurse

When we create the project using Composer, dependencies are installed automatically. If we clone the repository we need to do it manually.

To install the dependencies we make sure to be located in the project's root directory and then run:

  composer install

If we are going to work inside a Docker container, then we need to run the above command from a bash session as explained here: Initiate a bash session inside the Docker container.

Setup the sandboxes

Prefer Docker? then go to: Setup a Docker container.

Install in a subdirectory

If we are running the sandbox inside a Docker container we don't need do anything here.

If we are running the sandboxes in a subdirectory under our Web server's documents root we must follow these steps:

  • Rename the file sandbox.config-sample.php to sandbox.config.php.
  • Set the variable root as needed.

Lets suppose we installed the project under wwwroot/my-theme. In such case we'd do

  'root' => '/my-theme',

Create distributable files

Every time we make changes to any of the source files we must run the corresponding build script to create production-ready files also required by the sandboxes.

From the project's root directory run

  composer build-event
  
  // or
  
  composer build-wishlist

This will create dist/event and dist/wishlist directories respectively with all the files required to render a theme.

Demo card

If our project is under <document-root>/my-theme we need to navigate to the following URLs:

  http://localhost/my-theme/sandbox-event
  
  // or
  
  http://localhost/my-theme/sandbox-wishlist

If everything went well, we should see the default demo card or standalone wish list.

We are now ready to start Creating a theme.

tdk/setup.txt · Last modified: 2020/12/09 20:49 by admin