代码之家  ›  专栏  ›  技术社区  ›  Slam

调整Laravel刀片的Atom Beauty/JS Beautify

  •  0
  • Slam  · 技术社区  · 5 年前

    我喜欢在Atom中定制JS Beautify以更好地格式化我的blade文件。

    我们的手册样式如下:

    {{--
      Template Name: Full Width Template
    --}}
    <!-- template-fullwidth -->
    
    @extends('layouts.app')
    
    @section('content')
      @while(have_posts()) 
        @php the_post() @endphp
        @include('sections.content-page')
      @endwhile
    @endsection
    

    JS Beautify给我们的是:

    {{-- Template Name: Full Width Template
    --}}
    <!-- template-fullwidth -->
    @extends('layouts.app')
    @section('content')
    @while(have_posts())
    @php the_post()
    @endphp
    @include('sections.content-page')
    @endwhile
    @endsection
    

    我尝试过配置.jsbeauthorityrc文件,但是没有成功。

    1. 保留注释行
    2. 在select指令前添加空行[@extends,@section]
    3. @section指令中的缩进行
    4. 在@while和@if中缩进项
    5. 保持@php代码和@endphp在一行

    或者失败了所有这些都有某种可读的、格式良好的代码,而不仅仅是一长串指令。

    这能做到吗?

    0 回复  |  直到 5 年前