weprovide/aviate

该软件包已被 废弃 并不再维护。未建议替代软件包。

Aviate 编译器的连接器类

0.0.2 2017-09-20 06:55 UTC

This package is not auto-updated.

Last update: 2024-05-28 09:34:44 UTC


README

PHP 的 Aviate 实现。提供作为扩展特定框架的基本抽象类。

安装

composer require weprovide/aviate

示例

<?php
namespace WeProvide\Aviate\CustomImplementation;

use WeProvide\Aviate\Aviate;

class Bridge extends Aviate {
    // Required function for you to implement. This should return the directory that has the aviate.config.js
    public function getProjectRoot(): string {
        return '/your-directory';
    }

    // Used for convience / demonstration. This is not required
    public function isDevelopment(): bool {
        return true;
    }

    // Return a nested array with Javascript and CSS files to be included into the page
    public function getFiles(): array {
        $types = parent::getFiles();

        if($this->isDevelopment()) {
            // In development css is injected from Javascript to provide hot reloading.
            $types['js'][] = $this->getDevServerUrl('css-file.js');
            return $types;
        }
        
        // In production we load an actual CSS file
        $types['css'][] = 'css-file.css';
        return $types;
    }
}