gerillass 2.0.1 → 2.1.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 +23 -0
- package/SKILL.md +50 -5
- package/gerillass.json +304 -55
- package/package.json +1 -1
- package/scss/library/_after.scss +15 -0
- package/scss/library/_background-dots.scss +55 -9
- package/scss/library/_background-image.scss +31 -5
- package/scss/library/_background-stripes.scss +43 -4
- package/scss/library/_before.scss +15 -0
- package/scss/library/_brand-logo.scss +24 -1
- package/scss/library/_breakpoint.scss +29 -0
- package/scss/library/_container-query.scss +86 -0
- package/scss/library/_container.scss +26 -0
- package/scss/library/_counter.scss +24 -2
- package/scss/library/_font-face.scss +14 -0
- package/scss/library/_index.scss +3 -0
- package/scss/library/_line-clamp.scss +49 -0
- package/scss/library/_loadify.scss +18 -0
- package/scss/library/_reset-css.scss +7 -5
- package/scss/library/_screen-agent.scss +27 -0
- package/scss/library/_text-image.scss +24 -1
- package/scss/library/_triangle.scss +69 -7
- package/scss/utilities/_clear-unit.scss +4 -0
- package/scss/utilities/_convert-to-em.scss +6 -0
- package/scss/utilities/_convert-to-number.scss +15 -0
- package/scss/utilities/_fluid.scss +76 -0
- package/scss/utilities/_font-sizer.scss +14 -0
- package/scss/utilities/_index.scss +1 -0
- package/scss/utilities/_remify.scss +7 -0
- package/scss/utilities/_validate-length.scss +7 -0
- package/scss/utilities/_validate-ratio.scss +25 -2
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ Hope you’ll enjoy using it!
|
|
|
27
27
|
- [Installation](#installation)
|
|
28
28
|
- [Using with Vite](#using-with-vite)
|
|
29
29
|
- [Using with webpack](#using-with-webpack)
|
|
30
|
+
- [Using with Parcel](#using-with-parcel)
|
|
30
31
|
- [Using with Next.js](#using-with-nextjs)
|
|
31
32
|
- [Using with Angular](#using-with-angular)
|
|
32
33
|
- [Using with Gulp](#using-with-gulp)
|
|
@@ -94,6 +95,27 @@ Vite resolves the package by name, so there is nothing to configure. This covers
|
|
|
94
95
|
|
|
95
96
|
@use 'gerillass' as *;
|
|
96
97
|
|
|
98
|
+
### Using with Parcel
|
|
99
|
+
|
|
100
|
+
Parcel resolves the package by name too, so the usual line needs no configuration:
|
|
101
|
+
|
|
102
|
+
@use 'gerillass' as *;
|
|
103
|
+
|
|
104
|
+
**Remove `main` from your project's own `package.json`.** `npm init -y` writes `"main": "index.js"`, and Parcel reads that field as a library build target. With it present an app build fails, and the error names the stylesheet rather than the field: `Can't find stylesheet to import`. No Sass option gets around it. If you need to keep the field, turn that target off instead:
|
|
105
|
+
|
|
106
|
+
"targets": { "main": false }
|
|
107
|
+
|
|
108
|
+
To use a `pkg:` URL, create the importer in a `.sassrc.js`. Setting `pkgImporter` in `.sassrc.json` does not work: Parcel switches Sass to its legacy API for that option, and the import is not found.
|
|
109
|
+
|
|
110
|
+
// .sassrc.js
|
|
111
|
+
const { NodePackageImporter } = require("sass");
|
|
112
|
+
module.exports = { importers: [new NodePackageImporter()] };
|
|
113
|
+
|
|
114
|
+
Two more things worth knowing:
|
|
115
|
+
|
|
116
|
+
- **Pass the font formats you actually have to `font-face`.** It lists five by default, and Parcel resolves every `url()` in the output, so a folder holding only `.woff2` fails with `Failed to resolve './fonts/inter.eot'`. `$file-formats: woff2` fixes it.
|
|
117
|
+
- **`quietDeps` hides the library's own deprecation warnings.** Dart Sass reports its `if()` deprecation from inside the package on every build. A `.sassrc.json` of `{ "quietDeps": true }` silences those and still reports the ones in your own files.
|
|
118
|
+
|
|
97
119
|
### Using with Next.js
|
|
98
120
|
|
|
99
121
|
Next.js needs to be told where the library lives. In `next.config.mjs`:
|
|
@@ -187,6 +209,7 @@ Including to the project:
|
|
|
187
209
|
| Angular CLI | 20.3.36 |
|
|
188
210
|
| Gulp / gulp-sass | 5.0.1 / 6.0.1 |
|
|
189
211
|
| Grunt / grunt-sass | 1.6.3 / 4.1.0 |
|
|
212
|
+
| Parcel / @parcel/transformer-sass | 2.16.4 / 2.16.4, with Dart Sass 1.104.1 and Gerillass 2.1.0 |
|
|
190
213
|
|
|
191
214
|
## Using Gerillass with an AI coding agent
|
|
192
215
|
|
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: 53 mixins and 23 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
|
|
|
@@ -76,13 +76,17 @@ a dropped declaration rather than an error.
|
|
|
76
76
|
| `before` | `.a { @include before(42) { color: red; } }` |
|
|
77
77
|
| `border-box` | `@include border-box(only);` |
|
|
78
78
|
| `border-radius` | `.a { @include border-radius(1px, 2px, 3px); }` |
|
|
79
|
+
| `breakpoint` | `.a { @include breakpoint("between", "medium", "large") { color: red; } }` |
|
|
79
80
|
| `breakpointer` | `.a { @include breakpointer(42); }` |
|
|
80
81
|
| `center` | `.modal { @include center(diagonal); }` |
|
|
81
82
|
| `columnizer` | `.grid { @include columnizer(3, 20px, true, 9); }` |
|
|
83
|
+
| `container-query` | `.title { @include container-query("min", 400px, 800px) { color: red; } }` |
|
|
84
|
+
| `container` | `.card { @include container("card", sideways); }` |
|
|
82
85
|
| `escape-to-parent` | `.a { @include escape-to-parent(42) { color: red; } }` |
|
|
83
86
|
| `except` | `.a { @include except(#ff0000) { margin: 0; } }` |
|
|
84
87
|
| `font-face` | `.a { @include font-face("Inter", "/fonts/inter"); }` |
|
|
85
88
|
| `hide` | `.a { @include hide(nonsense); }` |
|
|
89
|
+
| `line-clamp` | `.a { @include line-clamp(0); }` |
|
|
86
90
|
| `linear-gradient` | `.a { @include linear-gradient(sideways, (red, blue)); }` |
|
|
87
91
|
| `loadify` | `@include loadify(nonsense);` |
|
|
88
92
|
| `only` | `.a { @include only(#ff0000) { margin: 0; } }` |
|
|
@@ -90,6 +94,7 @@ a dropped declaration rather than an error.
|
|
|
90
94
|
| `remove` | `.a { @include remove(a, b, c); }` |
|
|
91
95
|
| `reset-css` | `.a { @include reset-css; }` |
|
|
92
96
|
| `scissors` | `.a { @include scissors(5px 10px); }` |
|
|
97
|
+
| `screen-agent` | `.a { @include screen-agent(var(--density)) { color: red; } }` |
|
|
93
98
|
| `smartphone` | `.a { @include smartphone(Nokia3310) { display: none; } }` |
|
|
94
99
|
| `sprite` | `.icon { @include sprite("/img/sprite.txt"); }` |
|
|
95
100
|
| `stretched-link` | `.card a { @include stretched-link(middle); }` |
|
|
@@ -99,6 +104,42 @@ a dropped declaration rather than an error.
|
|
|
99
104
|
| `text-shadow` | `.a { @include text-shadow(42); }` |
|
|
100
105
|
| `triangle` | `.caret { @include triangle(sideways); }` |
|
|
101
106
|
|
|
107
|
+
## Traps a signature does not show
|
|
108
|
+
|
|
109
|
+
**`after`**
|
|
110
|
+
|
|
111
|
+
- With no argument no `content` is emitted, so the pseudo-element does not render unless the block sets `content`. Pass `""` for an empty one.
|
|
112
|
+
|
|
113
|
+
**`aspect-ratio`**
|
|
114
|
+
|
|
115
|
+
- On an element with a `height` attribute, such as `<img width="1600" height="900">` or an embed code's `<iframe>`, the attribute height wins and the ratio is ignored. Write `height: auto` after the include.
|
|
116
|
+
|
|
117
|
+
**`before`**
|
|
118
|
+
|
|
119
|
+
- With no argument no `content` is emitted, so the pseudo-element does not render unless the block sets `content`. Pass `""` for an empty one.
|
|
120
|
+
|
|
121
|
+
**`breakpoint`**
|
|
122
|
+
|
|
123
|
+
- With one argument the query matches exactly that width, `(width: 768px)`, which is a single pixel. Use `min`, `max` or a range for anything wider.
|
|
124
|
+
- Declarations written after the include, in the same rule, are emitted after the `@media` block and win over it. Write them before the include.
|
|
125
|
+
|
|
126
|
+
**`container`**
|
|
127
|
+
|
|
128
|
+
- An element does not match a `@container` query that reads its own container, and nothing warns. Put the `container-query` on a descendant.
|
|
129
|
+
|
|
130
|
+
**`counter`**
|
|
131
|
+
|
|
132
|
+
- Numbering restarts on every item, each showing the first number, when the items are size containers (`container-type: inline-size`): containment scopes counters to each item.
|
|
133
|
+
|
|
134
|
+
**`loadify`**
|
|
135
|
+
|
|
136
|
+
- `init` and every call must be in the same module, or the module with the call must `@use` the one that calls `init`. Otherwise Sass fails with "The target selector was not found".
|
|
137
|
+
|
|
138
|
+
**`remove`**
|
|
139
|
+
|
|
140
|
+
- With one argument the element is hidden at exactly that width, `(width: 768px)`, which is a single pixel. Use `min`, `max` or a range for anything wider.
|
|
141
|
+
- A `display` written after the include, in the same rule, is emitted after the `@media` block and wins over it. Write it before the include.
|
|
142
|
+
|
|
102
143
|
## Mixins
|
|
103
144
|
|
|
104
145
|
| Signature | What it does |
|
|
@@ -109,7 +150,7 @@ a dropped declaration rather than an error.
|
|
|
109
150
|
| `all-text-inputs($pseudo: null)` | Targets every text-like input at once, optionally in one pseudo-class state. |
|
|
110
151
|
| `antialias($value: null)` | Turns on subpixel-antialiased text smoothing. |
|
|
111
152
|
| `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
|
-
| `background-dots($color: null, $size: 1em, $gutter:
|
|
153
|
+
| `background-dots($color: null, $size: 1em, $gutter: null, $diagonal: true, $image: null)` | Repeating dot pattern as a background, optionally over an image. |
|
|
113
154
|
| `background-image($image-url: null, $filter-color: null, $filter-direction: null)` | Background image with an optional colour or gradient filter laid over it. |
|
|
114
155
|
| `background-stripes($color: null, $thickness: 1em, $rotation: -45deg, $image: null)` | Repeating stripe pattern as a background, optionally over an image. |
|
|
115
156
|
| `before($content: null)` | Styles the ::before pseudo-element. A `data-` argument becomes an attr() content value. |
|
|
@@ -122,20 +163,23 @@ a dropped declaration rather than an error.
|
|
|
122
163
|
| `circle($size)` | Square element with a fully rounded border, i.e. a circle. |
|
|
123
164
|
| `clearfix` | Clears floated children using an ::after pseudo-element. |
|
|
124
165
|
| `columnizer($params...)` | Flexbox grid of equal columns, with an optional gutter and fill behaviour. |
|
|
166
|
+
| `container-query($params...)` | A @container rule, taking the same argument shapes as breakpoint so the two read alike. Sizes may be a key from $map-for-breakpoints or a raw length, and a length is the common case because a container is usually narrower than the viewport. Nothing matches at all unless an ancestor was declared with the container mixin. |
|
|
167
|
+
| `container($name: null, $type: inline-size)` | Marks an element as a query container, so container-query can ask about its width instead of the viewport's. The rule that asks has to sit on a descendant: an element is never matched by a @container rule reading its own container, and nothing warns you when it is not. |
|
|
125
168
|
| `counter($params...)` | CSS counter for a list, with optional text before and after the number. |
|
|
126
169
|
| `ellipsis($width: 100%, $display: inline-block)` | Truncates a single line of text with an ellipsis. |
|
|
127
170
|
| `escape-to-parent($selector: null)` | Re-roots the current selector under another one using @at-root. |
|
|
128
171
|
| `except($params...)` | Selects every sibling except the ones named. |
|
|
129
172
|
| `font-face($font-family, $file-path, $font-style: normal, $font-weight: 400, $file-formats: eot woff2 woff ttf svg)` | Emits an @font-face rule for one family across several file formats. Must be called at the root. |
|
|
130
173
|
| `hide($toggle: "hide")` | Visually hides an element while keeping it available to screen readers, or reverses that. |
|
|
174
|
+
| `line-clamp($lines: 3)` | Truncates text after a number of lines, where ellipsis truncates one. It emits five declarations rather than one because -webkit-line-clamp does nothing on its own: without display: -webkit-box or without -webkit-box-orient: vertical the text is not clamped at all and nothing warns you, and without overflow: hidden the clamped text spills out below the box. The unprefixed line-clamp is emitted too, for when it becomes Baseline. |
|
|
131
175
|
| `linear-gradient($direction, $colors)` | Linear gradient background from a direction name or an angle. |
|
|
132
|
-
| `loadify($params...)` | Fades elements in on page load. Call once at the root to set up, then on each element. |
|
|
176
|
+
| `loadify($params...)` | Fades elements in on page load. Call once at the root to set up, then on each element. Under prefers-reduced-motion: reduce the end state is applied directly and no animation runs. Switching the animation off alone would not do, because the element starts invisible and the animation is what reveals it, so the content would stay hidden for good. |
|
|
133
177
|
| `only($params...)` | Selects only the siblings named. |
|
|
134
178
|
| `placeholder-shown` | Styles an input while its placeholder is visible. |
|
|
135
179
|
| `placeholder` | Styles the placeholder text of an input across vendor prefixes. |
|
|
136
180
|
| `position($position: absolute, $offsets: 0)` | Sets position and offsets in one call, using shorthand order. |
|
|
137
181
|
| `radial-gradient($shape, $position, $colors)` | Radial gradient background from a shape and a position. |
|
|
138
|
-
| `remove($params...)` | Hides an element outright, or
|
|
182
|
+
| `remove($params...)` | Hides an element outright, or within a media query: from a breakpoint up with min, up to it with max, or between two breakpoints. One breakpoint on its own hides the element at exactly that width, a single pixel. |
|
|
139
183
|
| `reset-css` | Meyer reset. Must be called at the root of the stylesheet. |
|
|
140
184
|
| `reset-figure` | Removes default figure margins and makes the image inside responsive. |
|
|
141
185
|
| `resizable($direction: both, $overflow: auto)` | Makes an element user-resizable. |
|
|
@@ -166,6 +210,7 @@ and camelCase is what tells them apart from the kebab-case mixins above.
|
|
|
166
210
|
| `convertToEm($value)` | Converts a pixel length to em, against a 16px base. |
|
|
167
211
|
| `convertToNumber($value)` | Parses a string of digits into a number. |
|
|
168
212
|
| `fillNulls($value, $seperation: comma, $skip: false)` | Replaces null entries in a list with 0, or drops them. |
|
|
213
|
+
| `fluid($min, $max, $min-viewport: 320px, $max-viewport: 1280px)` | A clamp() value that grows with the viewport between two widths, then stops. The preferred value keeps a rem term rather than being pure vw, because a vw-only value ignores browser text zoom and fails WCAG 1.4.4. It is a function rather than a mixin because the value is the hard part and belongs to any property, not only font-size. |
|
|
169
214
|
| `fontSizer($size, $time)` | Multiplies a size by a factor. Handy for a modular scale. |
|
|
170
215
|
| `fontSource($font-family, $file-path, $file-formats)` | Builds one src entry for an @font-face rule. |
|
|
171
216
|
| `isColor($value)` | Returns the value if every item in it is a colour, and errors otherwise. |
|
|
@@ -180,7 +225,7 @@ and camelCase is what tells them apart from the kebab-case mixins above.
|
|
|
180
225
|
| `shorthandProperty($value)` | Expands one to four values into the four-value CSS shorthand order. |
|
|
181
226
|
| `tint($color, $percentage)` | Mixes a colour towards white by a percentage. |
|
|
182
227
|
| `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. |
|
|
228
|
+
| `validateLength($value)` | Returns the value if it is a length or one of auto, inherit, initial, 0. Returns null quietly for null, so a caller can skip a value. |
|
|
184
229
|
| `validateRatio($ratio)` | Turns an aspect ratio into a value for the CSS aspect-ratio property. |
|
|
185
230
|
| `validateScissors($value)` | Normalises corner values for the scissors mixin, adding px where missing. |
|
|
186
231
|
|