yass 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +8 -3
- data/docs-src/layouts/default.html.liquid +29 -0
- data/docs-src/layouts/splash.html.liquid +39 -0
- data/docs-src/site/assets/45-degree-fabric-dark.png +0 -0
- data/docs-src/site/assets/Comic-Zine.woff +0 -0
- data/docs-src/site/assets/highlightjs-atom-one-dark.min.css +1 -0
- data/docs-src/site/assets/main.css.liquid +156 -0
- data/docs-src/site/helpers/index.md.liquid +93 -0
- data/docs-src/site/index.splash.md.liquid +57 -0
- data/docs-src/site/layouts-templates/index.md.liquid +49 -0
- data/docs-src/templates/nav.liquid +6 -0
- data/lib/yass/cli/helpers.rb +13 -16
- data/lib/yass/cli/runner.rb +4 -7
- data/lib/yass/config.rb +1 -4
- data/lib/yass/version.rb +1 -1
- metadata +15 -7
- data/site-template/layouts/default.html.liquid +0 -13
- data/site-template/site/assets/highlight.min.css +0 -9
- data/site-template/site/index.html.liquid +0 -1
- /data/{site-template → docs-src}/site/assets/highlight.min.js +0 -0
- /data/{site-template → docs-src}/templates/asset_tags.liquid +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbf192ae9cf4c4a5b3e25e2d9bf3dabdf3a1fececf59dad399d172011a6016f4
|
4
|
+
data.tar.gz: 7b39f236d0b15b947be5a8553feefa12d8a65b7fdacfd75c7d98049089c3dbc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad8980f7bcd8b5ff6a8620e21c083b21fb803296f7d19fe5e64ba0b9934f22c4d5f5df47d6e72297ca564fe990821d48795f824755da603f35ded65dd322b0ce
|
7
|
+
data.tar.gz: 0d82bbf8fc40f76a1da01a634d5673364353d3db5db116283520b5cea266df1880d29a5b86be6347fe41d0e47efcc3d02f3268a5d2bc74779c08d515d7e740f7
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Jordan Hollinger
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -6,16 +6,21 @@ Yass is an incredibly un-opinionated static site generator. [Learn more!](https:
|
|
6
6
|
|
7
7
|
## Getting started
|
8
8
|
|
9
|
-
Starting from
|
9
|
+
Starting from a blank page isn't fun, so `yass init` spits out the source to [jhollinger.github.io/yass/](https://jhollinger.github.io/yass/) to help get you started.
|
10
10
|
|
11
11
|
```bash
|
12
12
|
$ gem install yass
|
13
13
|
$ yass init blog
|
14
14
|
Creating blog/layouts/default.html.liquid
|
15
|
-
Creating blog/
|
15
|
+
Creating blog/layouts/splash.html.liquid
|
16
16
|
Creating blog/site/assets/highlight.min.js
|
17
|
-
Creating blog/site/
|
17
|
+
Creating blog/site/assets/highlightjs-atom-one-dark.min.css
|
18
|
+
Creating blog/site/assets/main.css.liquid
|
19
|
+
Creating blog/site/helpers/index.md.liquid
|
20
|
+
Creating blog/site/index.splash.md.liquid
|
21
|
+
Creating blog/site/layouts-templates/index.md.liquid
|
18
22
|
Creating blog/templates/asset_tags.liquid
|
23
|
+
Creating blog/templates/nav.liquid
|
19
24
|
$ cd blog
|
20
25
|
```
|
21
26
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6
|
+
<title>{{ page.title }}</title>
|
7
|
+
{% render "asset_tags", files: files, page: page %}
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div id="wrapper">
|
11
|
+
<header>
|
12
|
+
<h1><a href="{{ "index.html" | relative | strip_index }}">Yass</a></h1>
|
13
|
+
|
14
|
+
{% render "nav", page: page %}
|
15
|
+
</header>
|
16
|
+
|
17
|
+
<section id="main" class="flex">
|
18
|
+
<div class="flex"></div>
|
19
|
+
<div class="content">
|
20
|
+
{{ content }}
|
21
|
+
</div>
|
22
|
+
<div class="flex"></div>
|
23
|
+
</section>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<footer></footer>
|
27
|
+
<script>hljs.highlightAll()</script>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6
|
+
<title>{{ page.title }}</title>
|
7
|
+
{% render "asset_tags", files: files, page: page %}
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div id="wrapper">
|
11
|
+
<header>
|
12
|
+
<div></div>
|
13
|
+
{% render "nav", page: page %}
|
14
|
+
</header>
|
15
|
+
|
16
|
+
<section id="hero">
|
17
|
+
<div class="flex"></div>
|
18
|
+
<div>
|
19
|
+
<div id="title">Yass</div>
|
20
|
+
<div id="subtitle">
|
21
|
+
<p>Yet Another Static Site (generator)</p>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<div class="flex"></div>
|
25
|
+
</section>
|
26
|
+
|
27
|
+
<section id="main" class="flex">
|
28
|
+
<div class="flex"></div>
|
29
|
+
<div class="content">
|
30
|
+
{{ content }}
|
31
|
+
</div>
|
32
|
+
<div class="flex"></div>
|
33
|
+
</section>
|
34
|
+
|
35
|
+
<footer></footer>
|
36
|
+
</div>
|
37
|
+
<script>hljs.highlightAll()</script>
|
38
|
+
</body>
|
39
|
+
</html>
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#abb2bf;background:#282c34}.hljs-comment,.hljs-quote{color:#5c6370;font-style:italic}.hljs-doctag,.hljs-formula,.hljs-keyword{color:#c678dd}.hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#e06c75}.hljs-literal{color:#56b6c2}.hljs-addition,.hljs-attribute,.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#98c379}.hljs-attr,.hljs-number,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#d19a66}.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-symbol,.hljs-title{color:#61aeee}.hljs-built_in,.hljs-class .hljs-title,.hljs-title.class_{color:#e6c07b}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-link{text-decoration:underline}
|
@@ -0,0 +1,156 @@
|
|
1
|
+
:root {
|
2
|
+
--purple: rgb(24, 10, 28);
|
3
|
+
--med-purple: rgb(54, 30, 78);
|
4
|
+
--med-purple: rgb(74, 50, 98);
|
5
|
+
--dark-grey: rgb(41, 44, 51);
|
6
|
+
--med-grey: rgb(87, 89, 93);
|
7
|
+
--light-grey: rgb(137, 139, 143);
|
8
|
+
--off-white: #d1d1d1;
|
9
|
+
--off-black: #222;
|
10
|
+
--bg-image: url("{{ 'assets/45-degree-fabric-dark.png' | relative }}");
|
11
|
+
}
|
12
|
+
|
13
|
+
@font-face {
|
14
|
+
font-family: "Kingthings Typewriter";
|
15
|
+
src: url("Kingthings-Typewriter.woff") format("woff");
|
16
|
+
}
|
17
|
+
|
18
|
+
@font-face {
|
19
|
+
font-family: "Comic Zine";
|
20
|
+
src: url("Comic-Zine.woff") format("woff");
|
21
|
+
}
|
22
|
+
|
23
|
+
* {
|
24
|
+
box-sizing: border-box;
|
25
|
+
padding: 0;
|
26
|
+
margin: 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
body {
|
30
|
+
background-color: var(--dark-grey);
|
31
|
+
background-image: var(--bg-image);
|
32
|
+
color: var(--off-white);
|
33
|
+
}
|
34
|
+
|
35
|
+
header {
|
36
|
+
display: flex;
|
37
|
+
flex-direction: row;
|
38
|
+
justify-content: space-between;
|
39
|
+
align-items: center;
|
40
|
+
padding-left: 2rem;
|
41
|
+
}
|
42
|
+
|
43
|
+
header, #hero {
|
44
|
+
background-image: var(--bg-image);
|
45
|
+
background-color: var(--purple);
|
46
|
+
}
|
47
|
+
|
48
|
+
nav {
|
49
|
+
display: flex;
|
50
|
+
flex-direction: row;
|
51
|
+
flex-wrap: wrap;
|
52
|
+
justify-content: flex-end;
|
53
|
+
font-family: sans-serif;
|
54
|
+
}
|
55
|
+
|
56
|
+
nav > a:hover {
|
57
|
+
background-color: var(--off-white);
|
58
|
+
color: var(--purple);
|
59
|
+
box-shadow: inset 0px -8px 0px 0px var(--med-purple);
|
60
|
+
}
|
61
|
+
|
62
|
+
nav > a { padding: 1.5rem 2rem }
|
63
|
+
p { margin: 0.8rem 0 }
|
64
|
+
a {
|
65
|
+
color: var(--off-white);
|
66
|
+
text-decoration: none;
|
67
|
+
}
|
68
|
+
ul { margin: 1rem 0 1rem 1rem }
|
69
|
+
|
70
|
+
#wrapper {
|
71
|
+
display: flex;
|
72
|
+
flex-direction: column;
|
73
|
+
flex-wrap: nowrap;
|
74
|
+
width: 100vw;
|
75
|
+
min-height: 100vh;
|
76
|
+
}
|
77
|
+
|
78
|
+
#hero {
|
79
|
+
display: flex;
|
80
|
+
flex-direction: column;
|
81
|
+
padding: 3rem 0 6rem 0;
|
82
|
+
text-align: center;
|
83
|
+
}
|
84
|
+
|
85
|
+
#hero #title {
|
86
|
+
font-size: 10rem;
|
87
|
+
line-height: 9rem;
|
88
|
+
}
|
89
|
+
|
90
|
+
#hero #subtitle {
|
91
|
+
color: var(--light-grey);
|
92
|
+
font-size: 1.2rem;
|
93
|
+
}
|
94
|
+
|
95
|
+
#title, h1, h2, h3, h4, h5 { font-family: "Comic Zine", "Kingthings Typewriter", serif }
|
96
|
+
h1, h2, h3, h4, h5 { color: var(--purple) }
|
97
|
+
h1 { font-size: 3.0rem; margin: 1.5rem 0 0.5rem 0 }
|
98
|
+
h1:first-of-type { margin: 0 }
|
99
|
+
h2 { font-size: 2.25rem; margin: 1.5rem 0 0.5rem 0 }
|
100
|
+
h3 { font-size: 1.75rem; margin: 1.5rem 0 0.5rem 0 }
|
101
|
+
h4 { font-size: 1.5rem; margin: 1.5rem 0 0.5rem 0 }
|
102
|
+
h5 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem 0 }
|
103
|
+
|
104
|
+
#main {
|
105
|
+
display: flex;
|
106
|
+
flex-direction: row;
|
107
|
+
}
|
108
|
+
|
109
|
+
.content {
|
110
|
+
width: 60%;
|
111
|
+
padding: 3rem 5rem;
|
112
|
+
background-color: var(--off-white);
|
113
|
+
color: var(--off-black);
|
114
|
+
}
|
115
|
+
|
116
|
+
.content a {
|
117
|
+
color: var(--purple);
|
118
|
+
text-decoration: underline;
|
119
|
+
}
|
120
|
+
|
121
|
+
a.button {
|
122
|
+
display: inline-block;
|
123
|
+
background-color: var(--med-purple);
|
124
|
+
background-image: var(--bg-image);
|
125
|
+
padding: 0.8rem;
|
126
|
+
border-radius: 3px;
|
127
|
+
color: var(--off-white);
|
128
|
+
text-decoration: none;
|
129
|
+
font-family: sans-serif;
|
130
|
+
font-size: 0.9rem;
|
131
|
+
white-space: nowrap;
|
132
|
+
}
|
133
|
+
a.button:hover { background-color: var(--med-purple) }
|
134
|
+
|
135
|
+
footer {
|
136
|
+
padding: 20px;
|
137
|
+
text-align: center;
|
138
|
+
}
|
139
|
+
|
140
|
+
code { border-radius: 3px }
|
141
|
+
code:not(.hljs) {
|
142
|
+
background-color: #bbb;
|
143
|
+
padding: 2px 4px;
|
144
|
+
}
|
145
|
+
|
146
|
+
.flex { flex: 1 1 auto }
|
147
|
+
|
148
|
+
@media (max-width: 500px) {
|
149
|
+
nav > a { padding: 1rem 0.75rem }
|
150
|
+
nav > a.home { display: none }
|
151
|
+
.content {
|
152
|
+
width: 100%;
|
153
|
+
padding: 1rem 1.5rem;
|
154
|
+
background-color: #f5f5f5;
|
155
|
+
}
|
156
|
+
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# Helpers
|
2
|
+
|
3
|
+
Your `.liquid` files have access to all the [standard Liquid tags and filters](https://shopify.github.io/liquid) plus the following ones from Yass.
|
4
|
+
|
5
|
+
## Variables
|
6
|
+
|
7
|
+
### page
|
8
|
+
|
9
|
+
An object representing the current page. Properties:
|
10
|
+
|
11
|
+
* `title` A titleized version of the filename (e.g. *My File* from *my-file.html*)
|
12
|
+
* `src_path` Path with the original filename (e.g. *foo/bar/zorp.md.liquid*)
|
13
|
+
* `path` URL path relative to the relative root (e.g. *foo/bar/zorp.html*)
|
14
|
+
* `dirname` Directory file is in (e.g. *foo/bar* from *foo/bar/zorp.html*)
|
15
|
+
* `filename` Name of file (e.g. *zorp.html* from *foo/bar/zorp.html*)
|
16
|
+
* `extname` File extension (e.g. *.html* from *foo/bar/zorp.html*)
|
17
|
+
|
18
|
+
{% highlight html %}
|
19
|
+
<h1>{% echo "{{" %} page.title {% echo "}}" %}</h1>
|
20
|
+
{% endhighlight %}
|
21
|
+
|
22
|
+
### files
|
23
|
+
|
24
|
+
Any array of all files that will be written `dist/`. Same properties as `page`.
|
25
|
+
|
26
|
+
{% highlight html %}
|
27
|
+
{% echo '{% assign css_files = files | where: "extname", ".css" %' %}}
|
28
|
+
{% echo "{% for file in css_files %" %}}
|
29
|
+
<link rel="stylesheet" href="{% echo "{{ file.path | relative }}" %}">
|
30
|
+
{% echo "{% endfor %" %}}
|
31
|
+
{% endhighlight %}
|
32
|
+
|
33
|
+
## Filters
|
34
|
+
|
35
|
+
### relative
|
36
|
+
|
37
|
+
Modifies a path to be relative to the current file. Useful in layouts and template that need to refer to other files.
|
38
|
+
|
39
|
+
{% highlight html %}
|
40
|
+
<script src="{% echo "{{" %} "assets/main.js" | relative {% echo "}}" %}"></script>
|
41
|
+
{% endhighlight %}
|
42
|
+
|
43
|
+
If the above HTML was in `a/b/c.html.liquid`, the script source would be `../../assets/main.js`.
|
44
|
+
|
45
|
+
### strip_index
|
46
|
+
|
47
|
+
Removes trailing `index.html`s from URLs, on the assumption that web servers will handle that. Can be disabled with the `--no-strip-index` option (useful for development builds).
|
48
|
+
|
49
|
+
{% highlight html %}
|
50
|
+
<a href="{% echo '{{ "posts/index.html" | relative | strip_index }}' %}">Posts</a>
|
51
|
+
{% endhighlight %}
|
52
|
+
|
53
|
+
### match
|
54
|
+
|
55
|
+
Returns true if the string matches the regex.
|
56
|
+
|
57
|
+
{% highlight %}
|
58
|
+
{% echo '{% assign is_asset = page.path | match: "\.(css|js|jpe?g)$" %' %}}
|
59
|
+
{% endhighlight %}
|
60
|
+
|
61
|
+
### where_match
|
62
|
+
|
63
|
+
Works like Liquid's built-it `where`, but accepts a regular expression.
|
64
|
+
|
65
|
+
{% highlight %}
|
66
|
+
{% echo '{% assign posts = where_match: "path", "^posts/.+\.html$" %' %}}
|
67
|
+
{% endhighlight %}
|
68
|
+
|
69
|
+
## Tags
|
70
|
+
|
71
|
+
### highlight
|
72
|
+
|
73
|
+
Converts the given code into something useable by [Highlight.js](https://highlightjs.org/).
|
74
|
+
|
75
|
+
{% highlight %}
|
76
|
+
{% echo "{%" %} highlight ruby {% echo "%" %}{% echo "}" %}
|
77
|
+
puts "Yass!"
|
78
|
+
{% echo "{%" %} endhighlight {% echo "%" %}{% echo "}" %}
|
79
|
+
{% endhighlight %}
|
80
|
+
|
81
|
+
Hightlight.js CSS and JS files with common languages are included by default with `yass init`. [Download](https://highlightjs.org/download) your own versions if you want different languages or themes.
|
82
|
+
|
83
|
+
### render_content
|
84
|
+
|
85
|
+
Renders a template, passing the block as a variable named `content`.
|
86
|
+
|
87
|
+
The following will render the template `templates/my_template.liquid`:
|
88
|
+
|
89
|
+
{% highlight html %}
|
90
|
+
{% echo "{%" %} render_content "my_template" {% echo "%" %}{% echo "}" %}
|
91
|
+
<p>This will be rendered inside of "my_template" from a variable called "content"</p>
|
92
|
+
{% echo "{%" %} endrender_content {% echo "%" %}{% echo "}" %}
|
93
|
+
{% endhighlight %}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# What is Yass?
|
2
|
+
|
3
|
+
Yass is an astonishingly un-opinionated static site generator. Your sites's structure is entirely up to you: organize static assets, `.html` files, `.md` ([Markdown](https://commonmark.org/)) files, and `.liquid` ([Liquid](https://shopify.github.io/liquid/)) templates however you want under `site/`. Liquid layouts and reusable templates are supported but optional.
|
4
|
+
|
5
|
+
The **one** opinion Yass holds is that **you** should decide everything. There's zero configuration and no conventions to learn!
|
6
|
+
|
7
|
+
## Getting started
|
8
|
+
|
9
|
+
Starting from a blank page isn't fun, so `yass init` spits out the source to this very site to help get you started.
|
10
|
+
|
11
|
+
{% highlight bash %}
|
12
|
+
$ gem install yass
|
13
|
+
$ yass init blog
|
14
|
+
Creating blog/layouts/default.html.liquid
|
15
|
+
Creating blog/layouts/splash.html.liquid
|
16
|
+
Creating blog/site/assets/highlight.min.js
|
17
|
+
Creating blog/site/assets/highlightjs-atom-one-dark.min.css
|
18
|
+
Creating blog/site/assets/main.css.liquid
|
19
|
+
Creating blog/site/helpers/index.md.liquid
|
20
|
+
Creating blog/site/index.splash.md.liquid
|
21
|
+
Creating blog/site/layouts-templates/index.md.liquid
|
22
|
+
Creating blog/templates/asset_tags.liquid
|
23
|
+
Creating blog/templates/nav.liquid
|
24
|
+
$ cd blog
|
25
|
+
{% endhighlight %}
|
26
|
+
|
27
|
+
* `site/` contains your site's source.
|
28
|
+
* `layouts/` contains [Liquid](https://shopify.github.io/liquid/) layouts (optional).
|
29
|
+
* `templates/` contains reusable [Liquid](https://shopify.github.io/liquid/) templates (optional).
|
30
|
+
|
31
|
+
## Building
|
32
|
+
|
33
|
+
Build your site into the `dist/` directory with `yass build`.
|
34
|
+
|
35
|
+
{% highlight bash %}
|
36
|
+
$ yass build
|
37
|
+
{% endhighlight %}
|
38
|
+
|
39
|
+
## Previewing
|
40
|
+
|
41
|
+
To preview your site on your computer, simply open `dist/index.html` with your browser 🤯. (This requires using relative links, but there are helpers for that.)
|
42
|
+
|
43
|
+
If you're building for webserverless, local viewing, and using the `skip_index` filter anywhere, use the `--no-skip-index` option.
|
44
|
+
|
45
|
+
{% highlight bash %}
|
46
|
+
$ yass build --no-skip-index
|
47
|
+
{% endhighlight %}
|
48
|
+
|
49
|
+
The `watch` command will continuously build as you make changes in `site/`, `layouts/`, and `templates/`.
|
50
|
+
|
51
|
+
{% highlight bash %}
|
52
|
+
$ yass watch # --no-skip-index works here too
|
53
|
+
{% endhighlight %}
|
54
|
+
|
55
|
+
## Interested?
|
56
|
+
|
57
|
+
Keep reading about [layouts, templates]({{ "layouts-templates/index.html" | relative | strip_index }}), and [helpers]({{ "helpers/index.html" | relative | strip_index }}), or check out the code on [Github](https://github.com/jhollinger/yass)!
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Layouts
|
2
|
+
|
3
|
+
Layouts live in `layouts/` and will be applied to files with matching names. The `content` variable contains the data to render in the layout.
|
4
|
+
|
5
|
+
{% highlight html %}
|
6
|
+
<!DOCTYPE html>
|
7
|
+
<html lang="en">
|
8
|
+
<head>
|
9
|
+
<title>{% echo "{{ page.title }}" %}</title>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
{% echo "{{ content }}" %}
|
13
|
+
</body>
|
14
|
+
</html>
|
15
|
+
{% endhighlight %}
|
16
|
+
|
17
|
+
If the above layout is named *page.html.liquid*, it will match any file named `*.page.html*`. Examples:
|
18
|
+
|
19
|
+
* `foo.page.html`
|
20
|
+
* `foo.page.html.*`
|
21
|
+
* `foo.page.md` (because *.md* converts to *.html*)
|
22
|
+
* `foo.page.md.*`
|
23
|
+
|
24
|
+
The name of the layout (e.g. `page`) is removed from the final filename, resulting in `foo.html`.
|
25
|
+
|
26
|
+
## Default layouts
|
27
|
+
|
28
|
+
If you create a layout named `default.<ext>.liquid`, Yass will apply it to any `.<ext>` files without layouts. For example, a layout named `default.html.liquid` will match `foo.html` or `foo.not-a-layout.md.liquid`.
|
29
|
+
|
30
|
+
# Templates
|
31
|
+
|
32
|
+
Templates live in `templates/` and can be used in any `.liquid` files.
|
33
|
+
|
34
|
+
*templates/greeting.liquid*
|
35
|
+
|
36
|
+
{% highlight html %}
|
37
|
+
<p>Hi, my name is {% echo "{{ name }}" %}</p>
|
38
|
+
{% endhighlight %}
|
39
|
+
|
40
|
+
Render the above template with:
|
41
|
+
|
42
|
+
{% highlight html %}
|
43
|
+
{% liquid
|
44
|
+
echo '{% render "greeting", name: "Pleck" %'
|
45
|
+
echo '}'
|
46
|
+
%}
|
47
|
+
{% endhighlight %}
|
48
|
+
|
49
|
+
NOTE: Liquid is pretty strict about template filenames. They must match `^[a-zA-Z0-9_]\.liquid$`.
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<nav>
|
2
|
+
<a href="{{ "index.html" | relative | strip_index }}" class="home" >Home</a>
|
3
|
+
<a href="{{ "layouts-templates/index.html" | relative | strip_index }}">Layouts & Templates</a>
|
4
|
+
<a href="{{ "helpers/index.html" | relative | strip_index }}">Helpers</a>
|
5
|
+
<a href="https://github.com/jhollinger/yass">Github</a>
|
6
|
+
</nav>
|
data/lib/yass/cli/helpers.rb
CHANGED
@@ -3,17 +3,16 @@ require 'optparse'
|
|
3
3
|
module Yass
|
4
4
|
module CLI
|
5
5
|
module Helpers
|
6
|
-
def self.get_cmd(argv)
|
7
|
-
|
6
|
+
def self.get_cmd(argv) = argv[0].to_s.to_sym
|
7
|
+
|
8
|
+
def self.get_working_dir!(argv)
|
9
|
+
dir = argv[1] || Dir.pwd
|
10
|
+
find_path(dir, cwd: Dir.pwd)
|
8
11
|
end
|
9
12
|
|
10
|
-
def self.
|
11
|
-
|
12
|
-
|
13
|
-
$stderr.puts "Expected no more than #{max} args, found #{args.size}"
|
14
|
-
exit 1
|
15
|
-
end
|
16
|
-
args
|
13
|
+
def self.find_path(path, cwd:)
|
14
|
+
path = Pathname.new(path)
|
15
|
+
path.relative? ? Pathname.new(cwd).join(path) : path
|
17
16
|
end
|
18
17
|
|
19
18
|
def self.get_opts!
|
@@ -35,23 +34,21 @@ module Yass
|
|
35
34
|
opts.banner = %(
|
36
35
|
Yet Another Static Site (generator) v#{VERSION}
|
37
36
|
|
38
|
-
yass <command> [
|
37
|
+
yass <command> [path/to/dir] [options]
|
39
38
|
|
40
39
|
Build the site:
|
41
|
-
yass build
|
42
|
-
yass build path/to/dir
|
40
|
+
yass build [path/to/dir] [options]
|
43
41
|
|
44
42
|
Auto-build when files change:
|
45
|
-
yass watch
|
46
|
-
yass watch path/to/dir
|
43
|
+
yass watch [path/to/dir] [options]
|
47
44
|
|
48
45
|
Create a new site:
|
49
|
-
yass init
|
46
|
+
yass init [path/to/dir]
|
50
47
|
|
51
48
|
Options:
|
52
49
|
).strip
|
53
50
|
opts.on("--clean", "Remove unknown files from dist/ when bulding") { config.clean = true }
|
54
|
-
opts.on("--dest=", "Build to a different directory") { |
|
51
|
+
opts.on("--dest=DIR", "Build to a different directory") { |dir| config.dest = find_path(dir, cwd: Dir.pwd) }
|
55
52
|
opts.on("--no-strip-index", "Disable the strip_index Liquid filter") { config.strip_index = false }
|
56
53
|
opts.on("--debug", "Print stack traces") { config.debug = true }
|
57
54
|
opts.on("-h", "--help", "Prints this help") { config.stdout.puts opts; exit }
|
data/lib/yass/cli/runner.rb
CHANGED
@@ -3,11 +3,10 @@ require 'fileutils'
|
|
3
3
|
module Yass
|
4
4
|
module CLI
|
5
5
|
module Runner
|
6
|
-
INIT_DIR = Pathname.new(File.expand_path(File.join("..", "..", "..", "..", "
|
6
|
+
INIT_DIR = Pathname.new(File.expand_path(File.join("..", "..", "..", "..", "docs-src"), __FILE__))
|
7
7
|
|
8
8
|
def self.build(config, argv:)
|
9
|
-
|
10
|
-
config.cwd = Pathname.new(args[0] || Dir.pwd)
|
9
|
+
config.cwd = Helpers.get_working_dir! argv
|
11
10
|
Generator.new(config).generate!
|
12
11
|
return 0
|
13
12
|
rescue => e
|
@@ -17,16 +16,13 @@ module Yass
|
|
17
16
|
end
|
18
17
|
|
19
18
|
def self.init(config, argv:)
|
20
|
-
|
21
|
-
config.cwd = Pathname.new(args[0] || Dir.pwd)
|
22
|
-
|
19
|
+
config.cwd = Helpers.get_working_dir! argv
|
23
20
|
Dir[INIT_DIR.join("**/*.*")].each do |path|
|
24
21
|
dest = config.cwd.join Pathname.new(path).relative_path_from(INIT_DIR)
|
25
22
|
config.stdout.puts "Creating #{dest}"
|
26
23
|
FileUtils.mkdir_p dest.dirname unless dest.dirname.exist?
|
27
24
|
FileUtils.cp(path, dest) unless dest.exist?
|
28
25
|
end
|
29
|
-
|
30
26
|
return 0
|
31
27
|
rescue => e
|
32
28
|
raise e if config.debug
|
@@ -35,6 +31,7 @@ module Yass
|
|
35
31
|
end
|
36
32
|
|
37
33
|
def self.watch(config, argv:)
|
34
|
+
config.cwd = Helpers.get_working_dir! argv
|
38
35
|
config.stdout.puts "Watching for changes..."
|
39
36
|
watcher = Filewatcher.new([config.src_dir, config.layout_dir, config.template_dir].map(&:to_s))
|
40
37
|
yield watcher if block_given?
|
data/lib/yass/config.rb
CHANGED
data/lib/yass/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Hollinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: filewatcher
|
@@ -59,8 +59,21 @@ executables:
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- LICENSE
|
62
63
|
- README.md
|
63
64
|
- bin/yass
|
65
|
+
- docs-src/layouts/default.html.liquid
|
66
|
+
- docs-src/layouts/splash.html.liquid
|
67
|
+
- docs-src/site/assets/45-degree-fabric-dark.png
|
68
|
+
- docs-src/site/assets/Comic-Zine.woff
|
69
|
+
- docs-src/site/assets/highlight.min.js
|
70
|
+
- docs-src/site/assets/highlightjs-atom-one-dark.min.css
|
71
|
+
- docs-src/site/assets/main.css.liquid
|
72
|
+
- docs-src/site/helpers/index.md.liquid
|
73
|
+
- docs-src/site/index.splash.md.liquid
|
74
|
+
- docs-src/site/layouts-templates/index.md.liquid
|
75
|
+
- docs-src/templates/asset_tags.liquid
|
76
|
+
- docs-src/templates/nav.liquid
|
64
77
|
- lib/yass.rb
|
65
78
|
- lib/yass/cli.rb
|
66
79
|
- lib/yass/cli/helpers.rb
|
@@ -72,11 +85,6 @@ files:
|
|
72
85
|
- lib/yass/liquid_template.rb
|
73
86
|
- lib/yass/source.rb
|
74
87
|
- lib/yass/version.rb
|
75
|
-
- site-template/layouts/default.html.liquid
|
76
|
-
- site-template/site/assets/highlight.min.css
|
77
|
-
- site-template/site/assets/highlight.min.js
|
78
|
-
- site-template/site/index.html.liquid
|
79
|
-
- site-template/templates/asset_tags.liquid
|
80
88
|
homepage: https://jhollinger.github.io/yass/
|
81
89
|
licenses:
|
82
90
|
- MIT
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6
|
-
<title>{{ page.title }}</title>
|
7
|
-
{% render "asset_tags", files: files, page: page %}
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
{{ content }}
|
11
|
-
<script>hljs.highlightAll()</script>
|
12
|
-
</body>
|
13
|
-
</html>
|
@@ -1,9 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
Theme: Default
|
3
|
-
Description: Original highlight.js style
|
4
|
-
Author: (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
|
5
|
-
Maintainer: @highlightjs/core-team
|
6
|
-
Website: https://highlightjs.org/
|
7
|
-
License: see project LICENSE
|
8
|
-
Touched: 2021
|
9
|
-
*/pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#f3f3f3;color:#444}.hljs-comment{color:#697070}.hljs-punctuation,.hljs-tag{color:#444a}.hljs-tag .hljs-attr,.hljs-tag .hljs-name{color:#444}.hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag{font-weight:700}.hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type{color:#800}.hljs-section,.hljs-title{color:#800;font-weight:700}.hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable{color:#ab5656}.hljs-literal{color:#695}.hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code{color:#397300}.hljs-meta{color:#1f7199}.hljs-meta .hljs-string{color:#38a}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Home</h1>
|
File without changes
|
File without changes
|