gerillass 1.6.2 → 2.0.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.
- package/README.md +33 -9
- package/SKILL.md +32 -34
- package/gerillass.json +188 -196
- package/package.json +3 -13
- package/scss/_gerillass.scss +8 -92
- package/scss/library/_adaptive.scss +4 -1
- package/scss/library/_after.scss +5 -2
- package/scss/library/_all-buttons.scss +6 -2
- package/scss/library/_all-text-inputs.scss +6 -2
- package/scss/library/_aspect-ratio.scss +27 -0
- package/scss/library/_background-dots.scss +12 -7
- package/scss/library/_background-image.scss +18 -11
- package/scss/library/_background-stripes.scss +14 -9
- package/scss/library/_before.scss +5 -2
- package/scss/library/_border-radius.scss +19 -15
- package/scss/library/_brand-logo.scss +3 -1
- package/scss/library/_breakpoint.scss +25 -20
- package/scss/library/_breakpointer.scss +4 -1
- package/scss/library/_center.scss +3 -1
- package/scss/library/_columnizer.scss +18 -13
- package/scss/library/_counter.scss +21 -18
- package/scss/library/_escape-to-parent.scss +3 -1
- package/scss/library/_except.scss +12 -8
- package/scss/library/_font-face.scss +17 -12
- package/scss/library/_index.scss +52 -0
- package/scss/library/_linear-gradient.scss +13 -7
- package/scss/library/_loadify.scss +15 -11
- package/scss/library/_only.scss +12 -8
- package/scss/library/_position.scss +10 -6
- package/scss/library/_radial-gradient.scss +15 -9
- package/scss/library/_remove.scss +17 -14
- package/scss/library/_reset-figure.scss +3 -1
- package/scss/library/_scissors.scss +24 -21
- package/scss/library/_smartphone.scss +10 -6
- package/scss/library/_sprite.scss +16 -12
- package/scss/library/_stretched-link.scss +3 -1
- package/scss/library/_tablet.scss +10 -6
- package/scss/library/_text-gradient.scss +13 -7
- package/scss/library/_text-shadow.scss +46 -40
- package/scss/library/_triangle.scss +15 -10
- package/scss/lists/_index.scss +8 -0
- package/scss/maps/_index.scss +8 -0
- package/scss/utilities/_clear-unit.scss +3 -1
- package/scss/utilities/_clear-whitespace.scss +9 -6
- package/scss/utilities/_convert-to-em.scss +5 -2
- package/scss/utilities/_convert-to-number.scss +10 -6
- package/scss/utilities/_fill-nulls.scss +18 -0
- package/scss/utilities/_font-sizer.scss +1 -1
- package/scss/utilities/_font-source.scss +15 -10
- package/scss/utilities/_index.scss +24 -0
- package/scss/utilities/_is-color.scss +8 -5
- package/scss/utilities/_is-gutter.scss +8 -5
- package/scss/utilities/_is-number.scss +4 -2
- package/scss/utilities/_is-time.scss +8 -3
- package/scss/utilities/_map-deep-get.scss +4 -2
- package/scss/utilities/_pixelify.scss +11 -7
- package/scss/utilities/_pseudo-selector.scss +4 -2
- package/scss/utilities/_remify.scss +3 -1
- package/scss/utilities/_shade.scss +10 -0
- package/scss/utilities/_shorthand-property.scss +13 -11
- package/scss/utilities/_tint.scss +10 -0
- package/scss/utilities/_validate-breakpoint.scss +9 -5
- package/scss/utilities/_validate-length.scss +10 -5
- package/scss/utilities/_validate-ratio.scss +27 -15
- package/scss/utilities/_validate-scissors.scss +16 -11
- package/scss/_gerillass-prefix.scss +0 -1586
- package/scss/library/_ratio-box.scss +0 -19
- package/scss/library/_responsive-video.scss +0 -19
- package/scss/utilities/_darken.scss +0 -7
- package/scss/utilities/_lighten.scss +0 -7
- package/scss/utilities/_null.scss +0 -16
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
[Gerillass](https://gerillass.com) is a library built on top of [Sass (Syntactically Awesome Style Sheets)](https://sass-lang.com/) to give you flexibility for your projects and accelerate your performance and creativity.
|
|
10
10
|
|
|
11
|
+
It is also built to be read by coding agents. Every mixin and function ships with a machine-readable manifest, and the test suite compiles every documented example and asserts every documented refusal. So what the manifest says the library does is what the library does. The docs cannot drift away from the code, because a stale manifest fails the build.
|
|
12
|
+
|
|
11
13
|
Many of the utilities that come with Gerillass are the solutions I have come up with for the challenges I have faced as a frontend developer over the years. These solutions have been shaped by the inspiration of other popular libraries and frameworks like [Bourbon](https://www.bourbon.io/), [Susy](https://www.oddbird.net/), [Scut](https://github.com/davidtheclark/scut), [Bootstrap](https://getbootstrap.com/), etc. over time and helped me create Gerillass.
|
|
12
14
|
|
|
13
15
|
Hope you’ll enjoy using it!
|
|
@@ -32,7 +34,7 @@ Hope you’ll enjoy using it!
|
|
|
32
34
|
- [Cloning the Repository from Github](#cloning-the-repository-from-github)
|
|
33
35
|
- [Versions these examples were tested with](#versions-these-examples-were-tested-with)
|
|
34
36
|
- [Using Gerillass with an AI coding agent](#using-gerillass-with-an-ai-coding-agent)
|
|
35
|
-
- [
|
|
37
|
+
- [Three ways to call the same mixin](#three-ways-to-call-the-same-mixin)
|
|
36
38
|
- [Vendor Prefix Support](#vendor-prefix-support)
|
|
37
39
|
- [Experimenting](#experimenting)
|
|
38
40
|
- [Testing](#testing)
|
|
@@ -53,7 +55,7 @@ Or with Yarn:
|
|
|
53
55
|
|
|
54
56
|
yarn add gerillass --dev
|
|
55
57
|
|
|
56
|
-
Then load it. If your setup resolves packages from **node_modules
|
|
58
|
+
Then load it. If your setup resolves packages from **node_modules**, which Vite, webpack, Next.js and most modern bundlers do, this is all you need:
|
|
57
59
|
|
|
58
60
|
@use 'gerillass' as *;
|
|
59
61
|
|
|
@@ -79,7 +81,6 @@ Pointing straight at the file always works too:
|
|
|
79
81
|
|
|
80
82
|
The per-tool recipes below were each verified against a real build of Gerillass v1.5.0. The versions used are listed at the end of this section.
|
|
81
83
|
|
|
82
|
-
> **A note on eyeglass.** Gerillass still ships eyeglass module metadata, but eyeglass has not been released since June 2022 and its importer is broken with current Dart Sass — any `@import` fails with `doneImporting is not a function`, whether Gerillass is involved or not. It also relies on the legacy JS API, which Dart Sass removes in 2.0.0. Use the `pkg:` importer above instead; it is the built-in equivalent.
|
|
83
84
|
|
|
84
85
|
### Using with Vite
|
|
85
86
|
|
|
@@ -140,7 +141,7 @@ Then:
|
|
|
140
141
|
|
|
141
142
|
### Using with Grunt
|
|
142
143
|
|
|
143
|
-
Use `grunt-sass` with Dart Sass as the implementation. The option here is **`loadPaths`** as well
|
|
144
|
+
Use `grunt-sass` with Dart Sass as the implementation. The option here is **`loadPaths`** as well, not `loadPath`, and not `includePaths`.
|
|
144
145
|
|
|
145
146
|
module.exports = function (grunt) {
|
|
146
147
|
grunt.loadNpmTasks("grunt-sass");
|
|
@@ -189,25 +190,48 @@ Including to the project:
|
|
|
189
190
|
|
|
190
191
|
## Using Gerillass with an AI coding agent
|
|
191
192
|
|
|
192
|
-
|
|
193
|
+
A library this size has no training data behind it, so an agent asked to use Gerillass will guess at the argument forms and get them wrong. Two files ship with the package to stop that. Both live inside the installed package, so an agent working in your project can read them straight out of `node_modules/gerillass/`.
|
|
193
194
|
|
|
194
195
|
**`gerillass.json`** describes every mixin and function: its signature, what each argument accepts, examples that compile, and inputs that are refused.
|
|
195
196
|
|
|
196
197
|
const api = require("gerillass/gerillass.json");
|
|
197
198
|
|
|
198
|
-
**`SKILL.md`** is a written guide generated from that manifest
|
|
199
|
+
**`SKILL.md`** is a written guide generated from that manifest. It covers how to load the library, the full catalogue, and the argument forms that are easy to get wrong. If your agent supports [Agent Skills](https://code.claude.com/docs/en/skills), copy it into your skills folder:
|
|
199
200
|
|
|
200
201
|
mkdir -p .claude/skills/gerillass
|
|
201
202
|
cp node_modules/gerillass/SKILL.md .claude/skills/gerillass/
|
|
202
203
|
|
|
203
204
|
Otherwise, point your agent at the file and it will read it as plain Markdown.
|
|
204
205
|
|
|
205
|
-
|
|
206
|
+
### Why you can trust what they say
|
|
207
|
+
|
|
208
|
+
Neither file is written by hand. Signatures are parsed from the Sass sources, and the semantics come from a separate set of notes, so nobody can describe a mixin that does not exist.
|
|
209
|
+
|
|
210
|
+
The part that matters is what happens next. The test suite takes every example in the manifest and compiles it. It takes every input the manifest claims is refused and checks that the library really does refuse it, with its own error message rather than an internal Sass one. It runs every example a second time under the `gls-` prefixed name and requires byte-identical CSS. And it fails the build if either generated file is out of date.
|
|
211
|
+
|
|
212
|
+
So the manifest cannot claim behaviour the library does not have. That is the whole point of it. Documentation drifts away from code in most projects, quietly, and an agent reading stale docs writes code that does not work. Here it cannot happen without turning the test suite red first.
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
## Three ways to call the same mixin
|
|
216
|
+
|
|
217
|
+
None of them is required. Pick whichever reads best in your project, and stay with it in a given file.
|
|
218
|
+
|
|
219
|
+
**Bare.** The shortest, and fine unless another library defines the same name.
|
|
220
|
+
|
|
221
|
+
@use 'gerillass' as *;
|
|
222
|
+
.avatar { @include circle(50px); }
|
|
223
|
+
|
|
224
|
+
**With the `gls-` prefix.** Every mixin also answers to a prefixed name, which avoids collisions with Bootstrap and friends.
|
|
225
|
+
|
|
226
|
+
@use 'gerillass' as *;
|
|
227
|
+
.avatar { @include gls-circle(50px); }
|
|
206
228
|
|
|
229
|
+
**Through a namespace.** Sass's own mechanism, and the tidiest of the three: nothing enters your global scope at all, so a collision is impossible. The name after `as` is yours to choose.
|
|
207
230
|
|
|
208
|
-
|
|
231
|
+
@use 'gerillass' as gls;
|
|
232
|
+
.avatar { @include gls.circle(50px); }
|
|
209
233
|
|
|
210
|
-
|
|
234
|
+
All three produce identical CSS. The prefix predates the Sass module system; if you are starting fresh, the namespace does the same job without the extra name.
|
|
211
235
|
|
|
212
236
|
## Vendor Prefix Support
|
|
213
237
|
|
package/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Use the Gerillass Sass mixin library — loading it, the mixin cata
|
|
|
5
5
|
|
|
6
6
|
# Gerillass
|
|
7
7
|
|
|
8
|
-
A Sass mixin library:
|
|
8
|
+
A Sass mixin library: 50 mixins and 22 functions that emit CSS from
|
|
9
9
|
semantic declarations. It is Sass source only — there is no runtime and no
|
|
10
10
|
utility classes, so styles live in your stylesheet and your markup stays clean.
|
|
11
11
|
|
|
@@ -37,7 +37,7 @@ Dart Sass only. LibSass and node-sass are not supported.
|
|
|
37
37
|
|
|
38
38
|
## Two names for every mixin
|
|
39
39
|
|
|
40
|
-
Every mixin exists twice: bare (`
|
|
40
|
+
Every mixin exists twice: bare (`circle`) and prefixed (`gls-circle`).
|
|
41
41
|
They are the same mixin. The prefix exists to avoid collisions with other
|
|
42
42
|
libraries. Pick one and stay with it; do not mix them in a file.
|
|
43
43
|
|
|
@@ -45,17 +45,17 @@ With the module system you can namespace instead, which is usually cleaner:
|
|
|
45
45
|
|
|
46
46
|
```scss
|
|
47
47
|
@use "gerillass" as gls;
|
|
48
|
-
.
|
|
48
|
+
.avatar { @include gls.circle(50px); }
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
## Getting arguments right
|
|
52
52
|
|
|
53
53
|
The conventions are not uniform across the library, so check before guessing.
|
|
54
|
-
|
|
54
|
+
A mixin that wants a string will not take a bare value:
|
|
55
55
|
|
|
56
56
|
```scss
|
|
57
|
-
.
|
|
58
|
-
.
|
|
57
|
+
.a { @include after(42) { color: red; } } // wrong — errors
|
|
58
|
+
.a { @include after("→") { color: red; } } // right
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
Mixins that reject bad input do so with a message naming what they accept. If
|
|
@@ -69,6 +69,7 @@ a dropped declaration rather than an error.
|
|
|
69
69
|
| `all-buttons` | `@include all-buttons(nonsense) { color: red; }` |
|
|
70
70
|
| `all-text-inputs` | `@include all-text-inputs(nonsense) { color: red; }` |
|
|
71
71
|
| `antialias` | `@include antialias(only);` |
|
|
72
|
+
| `aspect-ratio` | `.thumb { @include aspect-ratio("16:9", nonsense); }` |
|
|
72
73
|
| `background-dots` | `.a { @include background-dots(red, 1em, 5em, maybe); }` |
|
|
73
74
|
| `background-image` | `.a { @include background-image("/img/a.png", (red, blue), sideways); }` |
|
|
74
75
|
| `background-stripes` | `.a { @include background-stripes(red, 2em, nonsense); }` |
|
|
@@ -86,10 +87,8 @@ a dropped declaration rather than an error.
|
|
|
86
87
|
| `loadify` | `@include loadify(nonsense);` |
|
|
87
88
|
| `only` | `.a { @include only(#ff0000) { margin: 0; } }` |
|
|
88
89
|
| `radial-gradient` | `.a { @include radial-gradient(42, "center", (red, blue)); }` |
|
|
89
|
-
| `ratio-box` | `.hero { @include ratio-box(16 9); }` |
|
|
90
90
|
| `remove` | `.a { @include remove(a, b, c); }` |
|
|
91
91
|
| `reset-css` | `.a { @include reset-css; }` |
|
|
92
|
-
| `responsive-video` | `.video { @include responsive-video(16 9); }` |
|
|
93
92
|
| `scissors` | `.a { @include scissors(5px 10px); }` |
|
|
94
93
|
| `smartphone` | `.a { @include smartphone(Nokia3310) { display: none; } }` |
|
|
95
94
|
| `sprite` | `.icon { @include sprite("/img/sprite.txt"); }` |
|
|
@@ -109,6 +108,7 @@ a dropped declaration rather than an error.
|
|
|
109
108
|
| `all-buttons($pseudo: null)` | Targets every button-like element at once, optionally in one pseudo-class state. |
|
|
110
109
|
| `all-text-inputs($pseudo: null)` | Targets every text-like input at once, optionally in one pseudo-class state. |
|
|
111
110
|
| `antialias($value: null)` | Turns on subpixel-antialiased text smoothing. |
|
|
111
|
+
| `aspect-ratio($ratio: null, $fit: cover)` | Holds an element to a ratio and adds what CSS aspect-ratio alone leaves out: object-fit so an image is cropped rather than stretched, and border: 0 so an iframe does not overflow its container by 4px. Apply it to the element itself, not to a wrapper. |
|
|
112
112
|
| `background-dots($color: null, $size: 1em, $gutter: $size * 5, $diagonal: true, $image: null)` | Repeating dot pattern as a background, optionally over an image. |
|
|
113
113
|
| `background-image($image-url: null, $filter-color: null, $filter-direction: null)` | Background image with an optional colour or gradient filter laid over it. |
|
|
114
114
|
| `background-stripes($color: null, $thickness: 1em, $rotation: -45deg, $image: null)` | Repeating stripe pattern as a background, optionally over an image. |
|
|
@@ -135,13 +135,11 @@ a dropped declaration rather than an error.
|
|
|
135
135
|
| `placeholder` | Styles the placeholder text of an input across vendor prefixes. |
|
|
136
136
|
| `position($position: absolute, $offsets: 0)` | Sets position and offsets in one call, using shorthand order. |
|
|
137
137
|
| `radial-gradient($shape, $position, $colors)` | Radial gradient background from a shape and a position. |
|
|
138
|
-
| `ratio-box($ratio: null)` | Container that holds a fixed aspect ratio. Its single direct child is stretched to fill it. |
|
|
139
138
|
| `remove($params...)` | Hides an element outright, or only within a breakpoint range. |
|
|
140
139
|
| `reset-css` | Meyer reset. Must be called at the root of the stylesheet. |
|
|
141
140
|
| `reset-figure` | Removes default figure margins and makes the image inside responsive. |
|
|
142
141
|
| `resizable($direction: both, $overflow: auto)` | Makes an element user-resizable. |
|
|
143
142
|
| `responsive-image` | Makes an image fill its container width. |
|
|
144
|
-
| `responsive-video($ratio: null)` | Wrapper that keeps an embedded video at a fixed aspect ratio. |
|
|
145
143
|
| `scissors($corners)` | Cuts the corners off an element with clip-path. |
|
|
146
144
|
| `screen-agent($resolution)` | Media query targeting a screen pixel density. |
|
|
147
145
|
| `sizer($width, $height: $width)` | Sets width and height together; one argument makes a square. |
|
|
@@ -158,33 +156,33 @@ a dropped declaration rather than an error.
|
|
|
158
156
|
|
|
159
157
|
## Functions
|
|
160
158
|
|
|
161
|
-
Called like normal Sass functions
|
|
162
|
-
|
|
159
|
+
Called like normal Sass functions, with no `@include`. They are public API,
|
|
160
|
+
and camelCase is what tells them apart from the kebab-case mixins above.
|
|
163
161
|
|
|
164
162
|
| Signature | What it does |
|
|
165
163
|
|---|---|
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
| `
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
179
|
-
| `
|
|
180
|
-
| `
|
|
181
|
-
| `
|
|
182
|
-
| `
|
|
183
|
-
| `
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
164
|
+
| `clearUnit($value)` | Strips the unit off a number, returning it unitless. |
|
|
165
|
+
| `clearWhitespace($string)` | Removes every space from a string. |
|
|
166
|
+
| `convertToEm($value)` | Converts a pixel length to em, against a 16px base. |
|
|
167
|
+
| `convertToNumber($value)` | Parses a string of digits into a number. |
|
|
168
|
+
| `fillNulls($value, $seperation: comma, $skip: false)` | Replaces null entries in a list with 0, or drops them. |
|
|
169
|
+
| `fontSizer($size, $time)` | Multiplies a size by a factor. Handy for a modular scale. |
|
|
170
|
+
| `fontSource($font-family, $file-path, $file-formats)` | Builds one src entry for an @font-face rule. |
|
|
171
|
+
| `isColor($value)` | Returns the value if every item in it is a colour, and errors otherwise. |
|
|
172
|
+
| `isGutter($value)` | True for anything that can sit where a CSS length is expected: a number, a calculation, or a CSS function such as var(). |
|
|
173
|
+
| `isNumber($value)` | Returns the value if it is a number. |
|
|
174
|
+
| `isTime($value)` | Returns the value if it is a time in s or ms, and errors otherwise. |
|
|
175
|
+
| `mapDeepGet($map, $keys...)` | Reads a value out of a nested map by following a chain of keys. |
|
|
176
|
+
| `pixelify($value)` | Returns the value with a px unit, adding one if it is missing. |
|
|
177
|
+
| `pseudoSelector($elements, $pseudo: null)` | Appends a pseudo-class to every selector in a list. |
|
|
178
|
+
| `remify($value)` | Converts a pixel length to rem, against a 16px root. |
|
|
179
|
+
| `shade($color, $percentage)` | Mixes a colour towards black by a percentage. |
|
|
180
|
+
| `shorthandProperty($value)` | Expands one to four values into the four-value CSS shorthand order. |
|
|
181
|
+
| `tint($color, $percentage)` | Mixes a colour towards white by a percentage. |
|
|
182
|
+
| `validateBreakpoint($value)` | Resolves a breakpoint name to its width, passing other values through. |
|
|
183
|
+
| `validateLength($value)` | Returns the value if it is a length or one of auto, inherit, initial, 0. |
|
|
184
|
+
| `validateRatio($ratio)` | Turns an aspect ratio into a value for the CSS aspect-ratio property. |
|
|
185
|
+
| `validateScissors($value)` | Normalises corner values for the scissors mixin, adding px where missing. |
|
|
188
186
|
|
|
189
187
|
## Checking your work
|
|
190
188
|
|