Stillat / blade-parser-typescript

A Laravel Blade parser, compiler, and static analyzer written in TypeScript.
https://stillat.com
MIT License
90 stars 3 forks source link

Laravel Blade plugin not working #74

Closed ikenye closed 1 year ago

ikenye commented 1 year ago

To reproduce:

1) Install LAravel 2) Install Tailwindcss - Refer to tailwind docs for laravel setup 3) I have the prettier plugin in VScode as well 4) Run npm install -D prettier prettier-plugin-blade prettier-plugin-tailwindcss 5) Create a .prettierrc file in the root directory. (Not needed but there are formats I like) 6) If you declare the plugins in the .prettierc file as below:

{ "plugins": [ "./node_modules/prettier-plugin-blade/", "./node_modules/prettier-plugin-tailwindcss/" ], }

and run npx prettier --write resources/ your get the following error:

[error] Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Okay let's not declare the plugins because of auto-discovery.

7) remove plugins from .prettierrc and run npx prettier --write resources/ again

this is the output:

PS C:\xampp\htdocs\prettier> npm run format

format npx prettier --write resources/

resources/css/app.css 28ms resources/js/app.js 66ms resources/js/bootstrap.js 15ms PS C:\xampp\htdocs\prettier> npm run format

The welcome blade file is ignored.

Oh sorry I have also added a .blade.format.json file with the following contents

{ "useLaravelPint": true }

luisprmat commented 1 year ago

I have the same issue with the same conditions ... i use laragon in Windows 11.

JohnathonKoster commented 1 year ago

Currently this plugin does not support prettier 3 (in progress). The configuration issue on Windows can be tracked within the prettier git repository:

https://github.com/prettier/prettier-vscode/issues/3062

Closing this as the plugin is still compatible with the latest version of prettier v2. prettier v3 progress can be tracked with #69