Skip to content

Commit

Permalink
Fix missing /js/blocks dir on twill:blocks command (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioribeiro authored and ifox committed Oct 17, 2019
1 parent 57fbdaf commit 4744042
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Commands/GenerateBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function handle()
'render' => $this->sanitize($vueBlockTemplate),
])->render();

$vueBlockPath = resource_path('assets/js/blocks/') . 'Block' . Str::title($blockName) . '.vue';
$vueBlockPath = $this->makeDirectory(resource_path('assets/js/blocks/')) . 'Block' . Str::title($blockName) . '.vue';

$this->filesystem->put($vueBlockPath, $vueBlockContent);

Expand All @@ -73,6 +73,20 @@ public function handle()
$this->info("All blocks have been generated!");
}

/**
* Recursively make a directory.
*
* @param string $directory
* @return string
*/
public function makeDirectory($directory)
{
if (!$this->filesystem->exists($directory)) {
$this->filesystem->makeDirectory($directory, 0755, true);
}
return $directory;
}

/**
* Sanitizes the given HTML code by removing redundant spaces and comments.
*
Expand Down

0 comments on commit 4744042

Please sign in to comment.