-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.stone
126 lines (99 loc) · 2.37 KB
/
test.stone
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{{-- Output Data --}}
Hello, {{ name }}.
The current UNIX timestamp is {{ Date.now() }}.
{{-- Outputting Data After Checking For Existence --}}
{{ name || 'Default' }}
{{-- Displaying Raw Text With Curly Braces --}}
@{{ This will 'not be processed' <strong>by Grind</strong> }}
{{-- Do not escape data --}}
Hello, {!! name || '<i>Default</i>' !!}.
{{-- Tagged components --}}
<p class="testing" date={Date.now()}></p>
<grind-tag date={Date.now()} data="testing"></grind-tag>
<grind date={Date.now()} required data="testing"></grind>
<grind date={Date.now()} data="testing" { ...({ grind: 'framework', bool: true, date: Date.now() }) } />
<grind>
<slot:title><h1>Grind</h1></slot:title>
</grind>
@include('header')
@include('footer')
@macro('a')
@endmacro
{{-- Define Grind Layout --}}
<html>
<head>
<title>
@hasSection('title')
@yield('title') - App Name
@else
App Name
@endif
</title>
</head>
<body>
@section('sidebar')
This is the master sidebar.
@endsection
<div class="container">
@yield('content')
</div>
</body>
</html>
{{-- Use Grind Layout --}}
@extends('layouts.master')
@section('sidebar')
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
@super
<p>This is my body content.</p>
@endsection
{{-- yield section --}}
@yield('section', 'Default Content')
{{-- If Statement --}}
@if(records.length === 1)
I have one record!
@elseif(records.length > 1)
I have multiple records!
@else
I don't have any records!
@endif
@unless(Auth.check())
You are not signed in.
@endunless
{{-- Loops --}}
@for(let i = 0; i < 10; i++)
The current value is {{ i }}
@endfor
@for(const user of users)
<p>This is user {{ user.id }}</p>
@endforeach
@forelse(const user of users)
<li>{{ user.name }}</li>
@empty
<p>No users</p>
@endforelse
@while(true)
<p>I'm looping forever.</p>
@endwhile
{{-- Include --}}
@include('view.name')
@include('view.name', { some: 'data' })
{{-- Overwriting Sections --}}
@extends('list.item.container')
@section('list.item.content')
<p>This is an item of type {{ item.type }}</p>
@overwrite
{{-- This comment will not be in the rendered HTML --}}
{{--
This comment will not be in the rendered HTML
This comment will not be in the rendered HTML
This comment will not be in the rendered HTML
--}}
{{-- Stacks --}}
@push('scripts')
<script src="/example.js"></script>
@endpush
<head>
@stack('scripts')
</head>