Skip to content

Latest commit

 

History

History
74 lines (58 loc) · 1.53 KB

CreateFolderStructure.md

File metadata and controls

74 lines (58 loc) · 1.53 KB

Create Folder Structure

Write Template

Noticed that you can create a Json, Yaml or Php file, you just need to follow the structure of the object.

The create the bellow structure...

@app_root/
├─ Folder1/
├─ Folder2/
│  ├─ Subfolder2/
│  ├─ doc.txt
├─ doc.txt

...you have to write this in your schema folder :

Structure:
  "@app_root":
    folders:
        Folder1: null
        Folder2:
            folders:
                Subfolder2: null
            files:
                doc.txt: null
    files:
        doc.txt: null

Create complex file

If you null is find in file, the script will create an empty file.

Just copy

In this exemple, the script will copy the file found in the source field

Structure:
  "@app_root":
    folders:
      docker:
        folders:
          nginx:
            files:
              nginx.conf:
                source: "@crazyphp_root/resources/Docker/docker/nginx/nginx.conf.hbs"

Use Template

But you can dynamically create a file using template engine like HandlbarsJS...

Here an exemple :

Structure:
  "@app_root":
    folders:
      docker:
        folders:
          nginx:
            files:
              nginx.conf:
                source: "@crazyphp_root/resources/Docker/docker/nginx/nginx.conf.hbs"
                engine: "CrazyPHP\\Library\\Template\\Handlebars"
  • source : Define the hbs file to use
  • engine : Define the classe PHP of the template engine to use (You have to write \\ because of yaml syntax)