@lang('users.index')
-
@foreach($users as $user)
-
{{ link_to_route("frontend.users.user.show",$users["name"],$users['_id']) }}
@endforeach
@lang('users.index')
@lang('users.index')
foo
`; const options = { indentSize: 4, wrapAttributes: "auto", wrapLineLength: 120, endWithNewLine: true, useTabs: false, sortTailwindcssClasses: true, }; new BladeFormatter(options).format(input).then((formatted) => { console.log(formatted); }); ``` ### ESModule ```js import BladeFormatter from "blade-formatter"; const { Formatter } = BladeFormatter; const input = `foo
`; const options = { indentSize: 2, }; new Formatter(options).formatContent(input).then((formatted) => { console.log(formatted); }); ``` ## Extensions - [vscode-blade-formatter](https://github.com/shufo/vscode-blade-formatter) - [VSCode](https://code.visualstudio.com/) Extension - [coc-blade](https://github.com/yaegassy/coc-blade) - [coc.nvim](https://github.com/neoclide/coc.nvim) Extension by [@yaegassy](https://github.com/yaegassy) - [prettier-plugin-blade](https://github.com/shufo/prettier-plugin-blade) - Prettier plugin for Blade - [null-ls.nvim](https://github.com/jose-elias-alvarez/null-ls.nvim) - Extension by [@jose-elias-alvarez](https://github.com/jose-elias-alvarez) ## Troubleshoot - If you encounter the following error during installation ``` $ npm install -g blade-formatter ~~ current user ("nobody") does not have permission to access the dev dir ~~ ``` Try setting the global user as root ``` $ npm -g config set user root ``` ## TODO - [x] custom directives - [x] `@for` directive support - [x] ignore formatting in blade comment - [x] automatically add new line after directive ## Development ```bash $ yarn install $ yarn run watch # watch changes ``` You can use local docker image for development. It might help if the host OS is not an amd64 architecture. ```bash $ make build $ make run example.php ``` ## Testing ```bash $ yarn install $ yarn run test ``` You can use local docker image for testing. It might help if the host OS is not an amd64 architecture. ```bash $ make build $ make test $ make debug # attach ``` ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request ## Contributors|
Shuhei Hayashibara |
Null |
SlovenianGooner |
Yaegassy |
Schelmo |
Dave |
|
Dian Fishekqi |
Gagandeep Singh |
Janos Horvath |
Joshua Chapman |
Jumpei Tanaka |