apiki/maristela-cli

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

v0.1.1 2019-04-30 12:02 UTC

README

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"
}