@@ -68,15 +68,18 @@ public function isDev(ViteHelperConfig|string|null $config = null): bool
6868 * * devEntries (string[]): entry files in development mode
6969 * * other options are rendered as attributes to the html tag
7070 *
71- * @param array $options see above
71+ * @param array|string $options file entrypoint or script options
7272 * @param \ViteHelper\Utilities\ViteHelperConfig|string|null $config config key or instance to use
7373 * @return void
7474 * @throws \ViteHelper\Exception\ConfigurationException
7575 * @throws \ViteHelper\Exception\ManifestNotFoundException|\ViteHelper\Exception\InvalidArgumentException
7676 */
77- public function script (array $ options = [], ViteHelperConfig |string |null $ config = null ): void
77+ public function script (array | string $ options = [], ViteHelperConfig |string |null $ config = null ): void
7878 {
7979 $ config = $ this ->createConfig ($ config );
80+ if (is_string ($ options )) {
81+ $ options = ['files ' => [$ options ]];
82+ }
8083 $ options ['block ' ] = $ options ['block ' ] ?? $ config ->read ('viewBlocks.script ' , ConfigDefaults::VIEW_BLOCK_SCRIPT );
8184 $ options ['cssBlock ' ] = $ options ['cssBlock ' ] ?? $ config ->read ('viewBlocks.css ' , ConfigDefaults::VIEW_BLOCK_CSS );
8285 $ options = $ this ->updateOptionsForFiltersAndEntries ($ options );
@@ -204,17 +207,19 @@ private function productionScript(array $options, ViteHelperConfig $config): voi
204207 * * devEntries (string[]): entry files in development mode
205208 * * other options are rendered as attributes to the html tag
206209 *
207- * @param array $options see above
210+ * @param array|string $options file entrypoint or css options
208211 * @param \ViteHelper\Utilities\ViteHelperConfig|string|null $config config key or instance to use
209212 * @return void
210213 * @throws \ViteHelper\Exception\ManifestNotFoundException
211214 * @throws \ViteHelper\Exception\ConfigurationException
212215 * @throws \ViteHelper\Exception\InvalidArgumentException
213216 */
214- public function css (array $ options = [], ViteHelperConfig |string |null $ config = null ): void
217+ public function css (array | string $ options = [], ViteHelperConfig |string |null $ config = null ): void
215218 {
216219 $ config = $ this ->createConfig ($ config );
217-
220+ if (is_string ($ options )) {
221+ $ options = ['files ' => [$ options ]];
222+ }
218223 // TODO the default should be css. This is a bug but might break in production.
219224 // So this should be replaced in a major release.
220225 $ options ['block ' ] = $ options ['block ' ] ?? $ config ->read ('viewBlocks.css ' , ConfigDefaults::VIEW_BLOCK_SCRIPT );
0 commit comments