nystudio107 /
craft-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 | use craft\helpers\App; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Vite config.php |
||
| 15 | * |
||
| 16 | * This file exists only as a template for the Vite settings. |
||
| 17 | * It does nothing on its own. |
||
| 18 | * |
||
| 19 | * Don't edit this file, instead copy it to 'craft/config' as 'vite.php' |
||
| 20 | * and make your changes there to override default settings. |
||
| 21 | * |
||
| 22 | * Once copied to 'craft/config', this file will be multi-environment aware as |
||
| 23 | * well, so you can have different settings groups for each environment, just as |
||
| 24 | * you do for 'general.php' |
||
| 25 | */ |
||
| 26 | |||
| 27 | return [ |
||
| 28 | |||
| 29 | /** |
||
|
0 ignored issues
–
show
|
|||
| 30 | * @var bool Should the dev server be used? |
||
| 31 | */ |
||
| 32 | 'useDevServer' => App::env('ENVIRONMENT') === 'dev' || App::env('CRAFT_ENVIRONMENT') === 'dev', |
||
| 33 | |||
| 34 | /** |
||
|
0 ignored issues
–
show
|
|||
| 35 | * @var string File system path (or URL) to the Vite-built manifest.json |
||
| 36 | */ |
||
| 37 | 'manifestPath' => '@webroot/dist/manifest.json', |
||
| 38 | |||
| 39 | /** |
||
|
0 ignored issues
–
show
|
|||
| 40 | * @var string The public URL to the dev server (what appears in `<script src="">` tags |
||
| 41 | */ |
||
| 42 | 'devServerPublic' => 'http://localhost:3000/', |
||
| 43 | |||
| 44 | /** |
||
|
0 ignored issues
–
show
|
|||
| 45 | * @var string The public URL to use when not using the dev server |
||
| 46 | */ |
||
| 47 | 'serverPublic' => App::env('PRIMARY_SITE_URL') . '/dist/', |
||
| 48 | |||
| 49 | /** |
||
|
0 ignored issues
–
show
|
|||
| 50 | * @var string|array The JavaScript entry from the manifest.json to inject on Twig error pages |
||
| 51 | * This can be a string or an array of strings |
||
| 52 | */ |
||
| 53 | 'errorEntry' => '', |
||
| 54 | |||
| 55 | /** |
||
|
0 ignored issues
–
show
|
|||
| 56 | * @var string String to be appended to the cache key |
||
| 57 | */ |
||
| 58 | 'cacheKeySuffix' => '', |
||
| 59 | |||
| 60 | /** |
||
|
0 ignored issues
–
show
|
|||
| 61 | * @var string The internal URL to the dev server, when accessed from the environment in which PHP is executing |
||
| 62 | * This can be the same as `$devServerPublic`, but may be different in containerized or VM setups. |
||
| 63 | * ONLY used if $checkDevServer = true |
||
| 64 | */ |
||
| 65 | 'devServerInternal' => '', |
||
| 66 | |||
| 67 | /** |
||
|
0 ignored issues
–
show
|
|||
| 68 | * @var bool Should we check for the presence of the dev server by pinging $devServerInternal to make sure it's running? |
||
| 69 | */ |
||
| 70 | 'checkDevServer' => false, |
||
| 71 | |||
| 72 | /** |
||
|
0 ignored issues
–
show
|
|||
| 73 | * @var bool Whether the react-refresh-shim should be included |
||
| 74 | */ |
||
| 75 | 'includeReactRefreshShim' => false, |
||
| 76 | |||
| 77 | /** |
||
|
0 ignored issues
–
show
|
|||
| 78 | * @var bool Whether the modulepreload-polyfill shim should be included |
||
| 79 | */ |
||
| 80 | 'includeModulePreloadShim' => true, |
||
| 81 | |||
| 82 | /** |
||
|
0 ignored issues
–
show
|
|||
| 83 | * @var string File system path (or URL) to where the Critical CSS files are stored |
||
| 84 | */ |
||
| 85 | 'criticalPath' => '@webroot/dist/criticalcss', |
||
| 86 | |||
| 87 | /** |
||
|
0 ignored issues
–
show
|
|||
| 88 | * @var string the suffix added to the name of the currently rendering template for the critical css file name |
||
| 89 | */ |
||
| 90 | 'criticalSuffix' => '_critical.min.css', |
||
| 91 | ]; |
||
| 92 |