- First commit, just began working on it
This commit is contained in:
commit
41586b354f
5 files changed
+98
No files matched your search
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Picea\Asset;
|
||||
|
||||
use Picea\Compiler;
|
||||
|
||||
class Asset {
|
||||
|
||||
public function registerExtension(Compiler $compiler) : self
|
||||
{
|
||||
$compiler->registerExtension(new Extension\ImportmapExtension());
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Picea\Asset\Connector;
|
||||
|
||||
class Npm
|
||||
{
|
||||
# @todo
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Picea\Asset\Extension;
|
||||
|
||||
use Picea\Compiler\Context;
|
||||
use Picea\Extension\Extension;
|
||||
use Picea\Extension\FunctionExtension;
|
||||
|
||||
class ImportmapExtension implements Extension {
|
||||
|
||||
public array $token = [ "importmap:print" ];
|
||||
|
||||
public function parse(Context &$context, ?string $arguments, string $token, array $options = []) : string
|
||||
{
|
||||
$cls = static::class;
|
||||
|
||||
switch($token) {
|
||||
case "importmap:print":
|
||||
return "PRINTED";
|
||||
}
|
||||
|
||||
$rendered = json_encode([
|
||||
'output !'
|
||||
]);
|
||||
|
||||
return "<?php echo '<script type=\"importmap\">$rendered</script>' ?>";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user