Repeats requested variables back as a placeholder for javascript templates in laravel

dev-master 2017-03-17 22:39 UTC

This package is auto-updated.

Last update: 2024-04-29 03:29:49 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

Install Via Composer

$ composer require awkwardideas/parrot

Add to config/app.php

Under Package Service Providers Add

AwkwardIdeas\Parrot\ParrotServiceProvider::class,

Under Facades/Class Aliases Add

'Parrot' => AwkwardIdeas\Parrot\Facades\Parrot::class,

Available Directives

@parrot('view.name', ['some' => "", 'data'=>"", 'parrotClass'=>"CustomClass", 'parrotID'=>"templateID"])
  • Similar to @include blade directive. Provide your own data to be used in the template, you only need to define the high level variables, actual values are not needed. Parrot will mock the values for these variables.
  • The parrotClass key can be provided to be output with @parrotClass. This will just echo the class, so it needs to be within a class="" attribute.
  • The parrotID key can be provided to be output with @parrotID. This will echo id='parrotIDValue', so that the ID can be optional on your markup.
@parrotif('view.name', ['some' => ""])

Similar to @includeif blade directive

@parrotClass

If the template is called with parrot, it will show the $parrotClass variable. A default class of parrotTemplate is output if a custom class is not provided.

@parrotID

If the template is called with parrot, it will show the $parrotID variable.

@onParrot

Starts an if case for when parrot is being used. If not being parroted, the template wont render the contained content. An @else may be used with @onParrot

@endOnParrot

Ends the if case for @onParrot

@noParrot

Starts an if case for when the template is being render without parrot. If being parroted, the template wont render the contained content. An @else may be used with @noParrot

@endNoParrot

Ends the if case for @endNoParrot