gerillass 2.3.1 → 3.0.0

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 CHANGED
@@ -32,6 +32,7 @@ Hope you’ll enjoy using it!
32
32
  - [Using with Angular](#using-with-angular)
33
33
  - [Using with Gulp](#using-with-gulp)
34
34
  - [Using with Grunt](#using-with-grunt)
35
+ - [Using with Ruby: Rails, Jekyll, or plain Sass](#using-with-ruby-rails-jekyll-or-plain-sass)
35
36
  - [Cloning the Repository from Github](#cloning-the-repository-from-github)
36
37
  - [Versions these examples were tested with](#versions-these-examples-were-tested-with)
37
38
  - [Using Gerillass with an AI coding agent](#using-gerillass-with-an-ai-coding-agent)
@@ -184,6 +185,35 @@ Then:
184
185
 
185
186
  @use 'gerillass' as *;
186
187
 
188
+ ### Using with Ruby: Rails, Jekyll, or plain Sass
189
+
190
+ Gerillass is also a gem. It installs the same Sass files and nothing else: no runtime dependencies, because each kind of project already brings its own Dart Sass. It needs Dart Sass; the LibSass-based `sass-rails` and `sassc-rails` cannot compile it.
191
+
192
+ bundle add gerillass
193
+
194
+ **Rails.** With `dartsass-rails` on Propshaft, the Rails 8 default, or `dartsass-sprockets` on Sprockets, there is nothing to configure: the gem hands the library's folder to Sass, and none of its files end up in `public/assets`. Then, in `app/assets/stylesheets/application.scss`:
195
+
196
+ @use 'gerillass' as *;
197
+
198
+ **Jekyll.** Put the gem in the plugins group of your `Gemfile`:
199
+
200
+ group :jekyll_plugins do
201
+ gem "gerillass"
202
+ end
203
+
204
+ Then, in a stylesheet with front matter such as `assets/css/main.scss`:
205
+
206
+ ---
207
+ ---
208
+ @use 'gerillass' as *;
209
+
210
+ **Plain Ruby.** Pass the library's folder to `sass-embedded` yourself:
211
+
212
+ require "sass-embedded"
213
+ require "gerillass"
214
+
215
+ Sass.compile("style.scss", load_paths: [Gerillass.load_path])
216
+
187
217
  ### Cloning the repository from Github
188
218
 
189
219
  You can clone the repository into your local computer from Github.
@@ -210,10 +240,15 @@ Including to the project:
210
240
  | Gulp / gulp-sass | 5.0.1 / 6.0.1 |
211
241
  | Grunt / grunt-sass | 1.6.3 / 4.1.0 |
212
242
  | Parcel / @parcel/transformer-sass | 2.16.4 / 2.16.4, with Dart Sass 1.104.1 and Gerillass 2.1.0 |
243
+ | Ruby / Rails | 4.0.1 / 8.1.3.1 |
244
+ | Propshaft / dartsass-rails | 1.3.2 / 0.5.1 |
245
+ | sprockets-rails / dartsass-sprockets | 3.5.2 / 3.2.1 |
246
+ | Jekyll / jekyll-sass-converter | 4.4.1 / 3.1.0 |
247
+ | sass-embedded (Ruby) | 1.104.1 |
213
248
 
214
249
  ## Using Gerillass with an AI coding agent
215
250
 
216
- 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/`.
251
+ 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/`, or, in a Ruby project, out of the gem's folder, which `bundle info gerillass --path` prints.
217
252
 
218
253
  **`gerillass.json`** describes every mixin and function: its signature, what each argument accepts, examples that compile, and inputs that are refused.
219
254
 
@@ -224,6 +259,10 @@ A library this size has no training data behind it, so an agent asked to use Ger
224
259
  mkdir -p .claude/skills/gerillass
225
260
  cp node_modules/gerillass/SKILL.md .claude/skills/gerillass/
226
261
 
262
+ In a Ruby project, copy it from the gem instead:
263
+
264
+ cp "$(bundle info gerillass --path)/SKILL.md" .claude/skills/gerillass/
265
+
227
266
  Otherwise, point your agent at the file and it will read it as plain Markdown.
228
267
 
229
268
  ### Why you can trust what they say
@@ -264,21 +303,21 @@ So, feel free to use any tool to support that. My suggestion is Autoprefixer. If
264
303
 
265
304
  ## Experimenting
266
305
 
267
- Experimentation with Gerillass is easy: If you're processing Sass files on your computer already, [download the Gerillass Sass library](https://github.com/selfishprimate/gerillass/archive/main.zip), include it in your project, and start using it. If not, use [Gerillass Play](https://github.com/selfishprimate/gerillass-play)! Gerillass Play is a Gulp based playground, built for you to get started with [Sass](https://sass-lang.com/) and [Gerillass](https://gerillass.com/) quickly.
306
+ The quickest way to try Gerillass is the [playground](https://gerillass.com/playground). It runs in your browser, so there is nothing to install: write Sass on one side and read the CSS it compiles to on the other. Pick a mixin to start from an example, and pick any published Gerillass version to compile against, which makes it easy to see how a call behaves before and after an upgrade.
268
307
 
269
- **Important Note**: Don't forget that you must have [Node.js](https://nodejs.org/en/) and [Gulp CLI](https://gulpjs.com/docs/en/getting-started/quick-start) installed on your machine to work with Gerillass Play.
308
+ When you are ready to use it in a project, follow the [installation](#installation) steps for your build tool.
270
309
 
271
310
  ## Testing
272
311
 
273
- Gerillass comes with a unit-testing module named [True](https://github.com/oddbird/true), which makes Sass unit tests possible (endless thanks to the [OddBird Team](https://github.com/oddbird)).
274
-
275
- You can find two test examples under the `test` folder, take your time, examine the codes, and then write your unit tests. After that, run the following command to see if the tests pass.
312
+ The test suite runs with [Jest](https://jestjs.io/) and [True](https://github.com/oddbird/true), which makes Sass unit tests possible (endless thanks to the [OddBird Team](https://github.com/oddbird)).
276
313
 
277
314
  npm test
278
315
 
316
+ It checks more than hand-written assertions: every mixin is called at least once, every documented example is compiled and compared with a snapshot, and every input a mixin should refuse must stop the build with the library's own error message. [CONTRIBUTING.md](CONTRIBUTING.md#testing) explains which of these a change needs.
317
+
279
318
  ## Contribution
280
319
 
281
- Please read the [contribution details](CONTRIBUTING.md) and feel free to contribute to the library.
320
+ Please read the [contribution details](CONTRIBUTING.md) and feel free to contribute to the library. If you are working on a mixin, the site's dev server has a lab that renders your working copy of the library as you edit it; [CONTRIBUTING.md](CONTRIBUTING.md#seeing-what-it-renders) shows how to use it.
282
321
 
283
322
  ## License
284
323
 
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: 56 mixins and 23 functions that emit CSS from
8
+ A Sass mixin library: 55 mixins and 24 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
 
@@ -33,7 +33,17 @@ Anything else, by pointing a load path at `node_modules/gerillass/scss`:
33
33
  @use "gerillass" as *;
34
34
  ```
35
35
 
36
- Dart Sass only. LibSass and node-sass are not supported.
36
+ In a Ruby project, from the `gerillass` gem. Rails with `dartsass-rails` or
37
+ `dartsass-sprockets`, and Jekyll with the gem in its `:jekyll_plugins` group,
38
+ need no configuration. Plain Ruby passes the folder to `sass-embedded` with
39
+ `load_paths: [Gerillass.load_path]`. Then:
40
+
41
+ ```scss
42
+ @use "gerillass" as *; // the gerillass gem: Rails and Jekyll need no setup; plain Ruby passes Gerillass.load_path
43
+ ```
44
+
45
+ Dart Sass only. LibSass and node-sass are not supported, which rules out
46
+ `sass-rails` and `sassc-rails` in Ruby.
37
47
 
38
48
  ## Two names for every mixin
39
49
 
@@ -90,14 +100,13 @@ a dropped declaration rather than an error.
90
100
  | `except` | `.a { @include except(#ff0000) { margin: 0; } }` |
91
101
  | `focus-ring` | `@include focus-ring;` |
92
102
  | `font-face` | `.a { @include font-face("Inter", "/fonts/inter"); }` |
103
+ | `gradient` | `.a { @include gradient((red, blue), sideways); }` |
93
104
  | `hide` | `.a { @include hide(nonsense); }` |
94
105
  | `line-clamp` | `.a { @include line-clamp(0); }` |
95
- | `linear-gradient` | `.a { @include linear-gradient(sideways, (red, blue)); }` |
96
106
  | `loadify` | `@include loadify(nonsense);` |
97
107
  | `motion-safe` | `.card { @include motion-safe; }` |
98
108
  | `only` | `.a { @include only(#ff0000) { margin: 0; } }` |
99
109
  | `position` | `.badge { @include position(absolute, 0, $logical: yes); }` |
100
- | `radial-gradient` | `.a { @include radial-gradient(42, "center", (red, blue)); }` |
101
110
  | `remove` | `.a { @include remove(a, b, c); }` |
102
111
  | `reset-css` | `.a { @include reset-css; }` |
103
112
  | `resizable` | `.a { @include resizable(huge); }` |
@@ -108,7 +117,7 @@ a dropped declaration rather than an error.
108
117
  | `sprite` | `.icon { @include sprite("/img/sprite.txt"); }` |
109
118
  | `stretched-link` | `.card a { @include stretched-link(middle); }` |
110
119
  | `tablet` | `.a { @include tablet(Surface) { display: none; } }` |
111
- | `text-gradient` | `.a { @include text-gradient(sideways, (red, blue)); }` |
120
+ | `text-gradient` | `.a { @include text-gradient("top", (red, blue)); }` |
112
121
  | `text-image` | `.a { @include text-image(16 9); }` |
113
122
  | `text-selection` | `.a { @include text-selection(bogus) { background: yellow; } }` |
114
123
  | `text-shadow` | `.a { @include text-shadow(42); }` |
@@ -132,12 +141,12 @@ a dropped declaration rather than an error.
132
141
 
133
142
  **`breakpoint`**
134
143
 
135
- - With one argument the query matches exactly that width, `(width: 768px)`, which is a single pixel, and the mixin prints a warning. Write `only` for that width, or `min`, `max` or a range for anything wider. 3.0.0 will refuse the one-argument form.
144
+ - With one argument the query matches exactly that width, `(width: 768px)`, which is a single pixel, and the mixin prints a warning. Write `only` for that width, or `min`, `max` or a range for anything wider.
136
145
  - Declarations written after the include, in the same rule, are emitted after the `@media` block and win over it. Write them before the include.
137
146
 
138
147
  **`container-query`**
139
148
 
140
- - A size on its own matches exactly that width, `(width: 400px)`, which is a single pixel, and the mixin prints a warning. Write `only` for that width, or `min`, `max` or a range for anything wider. 3.0.0 will refuse the one-argument form.
149
+ - A size on its own matches exactly that width, `(width: 400px)`, which is a single pixel, and the mixin prints a warning. Write `only` for that width, or `min`, `max` or a range for anything wider.
141
150
 
142
151
  **`container`**
143
152
 
@@ -165,7 +174,7 @@ a dropped declaration rather than an error.
165
174
 
166
175
  **`remove`**
167
176
 
168
- - With one argument the element is hidden at exactly that width, `(width: 768px)`, which is a single pixel, and the mixin prints a warning. Write `only` for that width, or `min`, `max` or a range for anything wider. 3.0.0 will refuse the one-argument form.
177
+ - With one argument the element is hidden at exactly that width, `(width: 768px)`, which is a single pixel, and the mixin prints a warning. Write `only` for that width, or `min`, `max` or a range for anything wider.
169
178
  - 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.
170
179
 
171
180
  ## Mixins
@@ -199,16 +208,15 @@ a dropped declaration rather than an error.
199
208
  | `except($params...)` | Selects every sibling except the ones named. |
200
209
  | `focus-ring($width: 2px, $offset: 2px, $color: currentColor)` | Draws a keyboard focus ring with outline on :focus-visible, which survives forced-colors mode where a box-shadow ring disappears. |
201
210
  | `font-face($font-family, $file-path, $font-style: normal, $font-weight: 400, $file-formats: eot woff2 woff ttf svg, $font-display: null)` | Emits an @font-face rule for one family across several file formats. Must be called at the root. |
211
+ | `gradient($colors, $type: linear, $direction: null, $shape: null, $position: null, $from: null, $in: null, $repeating: false)` | A linear, radial or conic gradient as background-image, plain or repeating, with an optional colour interpolation space. Replaced linear-gradient and radial-gradient in 3.0.0. |
202
212
  | `hide($toggle: "hide")` | Visually hides an element while keeping it available to screen readers, or reverses that. |
203
213
  | `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. |
204
- | `linear-gradient($direction, $colors)` | Linear gradient background from a direction name or an angle. |
205
214
  | `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. |
206
215
  | `motion-safe` | Wraps its content in @media (prefers-reduced-motion: no-preference), so motion is opt-in: a user who asked their system for less motion gets none of it. |
207
216
  | `only($params...)` | Selects only the siblings named. |
208
217
  | `placeholder-shown` | Styles an input while its placeholder is visible. |
209
218
  | `placeholder` | Styles the placeholder text of an input across vendor prefixes. |
210
219
  | `position($position: absolute, $offsets: 0, $logical: false)` | Sets position and offsets in one call, using shorthand order. |
211
- | `radial-gradient($shape, $position, $colors)` | Radial gradient background from a shape and a position. |
212
220
  | `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, and prints a warning: pass only for that. |
213
221
  | `reset-css` | Meyer reset. Must be called at the root of the stylesheet. |
214
222
  | `reset-figure` | Removes default figure margins and makes the image inside responsive. |
@@ -221,7 +229,7 @@ a dropped declaration rather than an error.
221
229
  | `sprite($params...)` | Sets up an element as a sprite tile: an image, a background position, or both. |
222
230
  | `stretched-link($value: "before")` | Expands a link to cover its positioned parent, so the whole card is clickable. |
223
231
  | `tablet($device, $orientation: null)` | Media query targeting a known tablet by device dimensions. |
224
- | `text-gradient($direction, $colors)` | Applies a linear gradient to the text itself via background-clip. |
232
+ | `text-gradient($colors, $type: linear, $direction: null, $shape: null, $position: null, $from: null, $in: null, $repeating: false)` | Fills the text with a gradient through background-clip: text. It takes the gradient mixin's arguments, colours first: a linear, radial or conic gradient, plain or repeating, with an optional colour space. |
225
233
  | `text-image($image: null)` | Fills the text with an image via background-clip. |
226
234
  | `text-selection($value: null)` | Styles the ::selection pseudo-element. |
227
235
  | `text-shadow($params...)` | Layered text shadows built from a direction, a colour and an offset. |
@@ -244,6 +252,7 @@ and camelCase is what tells them apart from the kebab-case mixins above.
244
252
  | `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. |
245
253
  | `fontSizer($size, $time)` | Multiplies a size by a factor. Handy for a modular scale. |
246
254
  | `fontSource($font-family, $file-path, $file-formats)` | Builds one src entry for an @font-face rule. |
255
+ | `gradientValue($colors, $type: linear, $direction: null, $shape: null, $position: null, $from: null, $in: null, $repeating: false)` | The gradient mixin's gradient as a value, for layering it with an image in one background-image, or using it as a mask-image or border-image. It takes the same arguments and refuses the same input, but cannot write the fallback the mixin writes before a gradient with $in. |
247
256
  | `isColor($value)` | Returns the value if every item in it is a colour, and errors otherwise. |
248
257
  | `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(). |
249
258
  | `isNumber($value)` | Returns the value if it is a number. |