Skip to content

Generate pure html files based on a PHP file and a mock.

Notifications You must be signed in to change notification settings

Apiki/maristela-cli

Repository files navigation

Maristela CLI Build Status Scrutinizer Code Quality

Generate pure html files based on a PHP file and a mock.

Requiriments

  1. Folder structure:
.
└── components/
    ├── card/
    │   ├── index.php
    │   └── mock.json
    └── header/
        ├── index.php
        └── mock.json
  1. Component card as example:

index.php

<div>
    <div><?php echo $title; ?></div>
    <ul>
        <?php foreach ($items as $item) : ?>
        <li><?php echo $item['name']; ?></li>
        <li><?php echo $item['age']; ?></li>
        <?php endforeach; ?>
    </ul>
</div>

mock.json

{
  "title": "My card",
  "items": [
    {
      "name": "John Doe",
      "age": 24
    },
    {
      "name": "Mary Doe",
      "age": 28
    }
  ]
}

Install

  1. Run composer require --dev apiki/maristela-cli on terminal;
  2. Add a new script on composer.json:
  "scripts": {
    "make:components": "Maristela\\Cli\\App::buildComponents"
  }
  1. Run composer make:components on terminal;
  2. Will be generated a _static folder inside your components folder.
  3. You can override default components creating a .maristela-cli.json on your project and setting a value for componentsDir:

.maristela-cli.json

{
  "componentsDir": "components"
}