nystudio107 /
craft-plugin-vite
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Vite plugin for Craft CMS |
||
| 4 | * |
||
| 5 | * Allows the use of the Vite.js next generation frontend tooling with Craft CMS |
||
| 6 | * |
||
| 7 | * @link https://nystudio107.com |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 8 | * @copyright Copyright (c) 2021 nystudio107 |
||
|
0 ignored issues
–
show
|
|||
| 9 | */ |
||
|
0 ignored issues
–
show
|
|||
| 10 | |||
| 11 | namespace nystudio107\pluginvite\variables; |
||
| 12 | |||
| 13 | use Twig\Markup; |
||
| 14 | use yii\base\InvalidConfigException; |
||
| 15 | |||
| 16 | /** |
||
|
0 ignored issues
–
show
|
|||
| 17 | * @author nystudio107 |
||
|
0 ignored issues
–
show
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
|
|||
| 18 | * @package Vite |
||
|
0 ignored issues
–
show
|
|||
| 19 | * @since 1.0.4 |
||
|
0 ignored issues
–
show
|
|||
| 20 | */ |
||
|
0 ignored issues
–
show
|
|||
| 21 | interface ViteVariableInterface |
||
| 22 | { |
||
| 23 | // Public Methods |
||
| 24 | // ========================================================================= |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Return the appropriate tags to load the Vite script, either via the dev server or |
||
| 28 | * extracting it from the manifest.json file |
||
| 29 | * |
||
| 30 | * @param string $path |
||
|
0 ignored issues
–
show
|
|||
| 31 | * @param bool $asyncCss |
||
|
0 ignored issues
–
show
|
|||
| 32 | * @param array $scriptTagAttrs |
||
|
0 ignored issues
–
show
|
|||
| 33 | * @param array $cssTagAttrs |
||
|
0 ignored issues
–
show
|
|||
| 34 | * |
||
| 35 | * @return Markup |
||
| 36 | */ |
||
| 37 | public function script(string $path, bool $asyncCss = true, array $scriptTagAttrs = [], array $cssTagAttrs = []): Markup; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Register the appropriate tags to the Craft View to load the Vite script, either via the dev server or |
||
| 41 | * extracting it from the manifest.json file |
||
| 42 | * |
||
| 43 | * @param string $path |
||
|
0 ignored issues
–
show
|
|||
| 44 | * @param bool $asyncCss |
||
|
0 ignored issues
–
show
|
|||
| 45 | * @param array $scriptTagAttrs |
||
|
0 ignored issues
–
show
|
|||
| 46 | * @param array $cssTagAttrs |
||
|
0 ignored issues
–
show
|
|||
| 47 | * |
||
| 48 | * @return Markup |
||
| 49 | * @throws InvalidConfigException |
||
| 50 | */ |
||
| 51 | public function register(string $path, bool $asyncCss = true, array $scriptTagAttrs = [], array $cssTagAttrs = []): Markup; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Return the URL for the given entry |
||
| 55 | * |
||
| 56 | * @param string $path |
||
|
0 ignored issues
–
show
|
|||
| 57 | * |
||
| 58 | * @return Markup |
||
| 59 | */ |
||
| 60 | public function entry(string $path): Markup; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Return the URL for the given asset |
||
| 64 | * |
||
| 65 | * @param string $path |
||
|
0 ignored issues
–
show
|
|||
| 66 | * |
||
| 67 | * @return Markup |
||
| 68 | */ |
||
| 69 | public function asset(string $path): Markup; |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Inline the contents of a local file (via path) or remote file (via URL) in your templates. |
||
| 73 | * Yii2 aliases and/or environment variables may be used |
||
| 74 | * |
||
| 75 | * @param string $pathOrUrl |
||
|
0 ignored issues
–
show
|
|||
| 76 | * |
||
| 77 | * @return Markup |
||
| 78 | */ |
||
| 79 | public function inline(string $pathOrUrl): Markup; |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Determine whether the Vite dev server is running |
||
| 83 | * |
||
| 84 | * @return bool |
||
| 85 | */ |
||
| 86 | public function devServerRunning(): bool; |
||
| 87 | } |
||
| 88 |