예제 #1
0
<?php

use Wuild\Console;
Wuild::task('create:post', function () {
    // $this->arguments 사용가능해야함.
    if (!isset($_SERVER['argv'][2])) {
        return false;
    }
    $subject = $_SERVER['argv'][2];
    $fileName = '_posts/' . date('Y-m-d') . '-' . $subject . '.md';
    $date = date('Y-m-d H:i:s');
    file_put_contents($fileName, "---\nlayout: post\ntitle: \"{$subject}\"\ndate: {$date}\ncategories: \n---\n\n");
    Console::execute("open {$fileName}");
    Console::writeLine("Create Success!");
});
예제 #2
0
<?php

use Wuild\FileSystem\Directory;
use Wuild\FileSystem\File;
use Wuild\Console;
require __DIR__ . '/vendor/autoload.php';
Wuild::task('build:less', function () {
    $files = (new Directory(__DIR__ . '/public/static'))->getAllFiles();
    $lessFiles = $files->filter(function (File $file) {
        return $file->getExtension() === 'less';
    });
    foreach ($lessFiles as $file) {
        Console::execute("lessc {$file} > " . $file->getPath() . '/' . $file->getNameOnly() . '.css');
    }
});