gerillass 0.0.6 → 2.3.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.md +13 -0
- data/README.md +328 -0
- data/SKILL.md +283 -0
- data/gerillass.json +2551 -0
- data/lib/gerillass/engine.rb +55 -0
- data/lib/gerillass/jekyll.rb +13 -0
- data/lib/gerillass.rb +26 -0
- data/scss/_gerillass.scss +15 -0
- data/scss/internal/_color-problem.scss +99 -0
- data/scss/internal/_color-stops-problem.scss +94 -0
- data/scss/internal/_condition-width.scss +22 -0
- data/scss/internal/_custom-property-in.scss +25 -0
- data/scss/internal/_image-value.scss +68 -0
- data/scss/internal/_is-condition-value.scss +94 -0
- data/scss/internal/_is-css-function.scss +21 -0
- data/scss/internal/_is-size.scss +22 -0
- data/scss/internal/_keyword-value.scss +76 -0
- data/scss/internal/_length-problem.scss +127 -0
- data/scss/internal/_sibling-index.scss +51 -0
- data/scss/internal/_words.scss +35 -0
- data/scss/library/_adaptive.scss +31 -0
- data/scss/library/_after.scss +28 -0
- data/scss/library/_all-buttons.scss +21 -0
- data/scss/library/_all-text-inputs.scss +21 -0
- data/{core → scss}/library/_antialias.scss +5 -1
- data/scss/library/_aspect-ratio.scss +27 -0
- data/scss/library/_background-dots.scss +103 -0
- data/scss/library/_background-image.scss +113 -0
- data/scss/library/_background-stripes.scss +99 -0
- data/scss/library/_before.scss +28 -0
- data/scss/library/_border-box.scss +30 -0
- data/scss/library/_border-radius.scss +164 -0
- data/scss/library/_brand-logo.scss +33 -0
- data/scss/library/_breakpoint.scss +96 -0
- data/scss/library/_breakpointer.scss +40 -0
- data/scss/library/_center.scss +19 -0
- data/scss/library/_circle.scss +15 -0
- data/{core → scss}/library/_clearfix.scss +1 -1
- data/scss/library/_columnizer.scss +125 -0
- data/scss/library/_container-query.scss +119 -0
- data/scss/library/_container.scss +72 -0
- data/scss/library/_counter.scss +59 -0
- data/scss/library/_ellipsis.scss +87 -0
- data/scss/library/_escape-to-parent.scss +12 -0
- data/scss/library/_except.scss +71 -0
- data/scss/library/_focus-ring.scss +63 -0
- data/scss/library/_font-face.scss +240 -0
- data/scss/library/_hide.scss +25 -0
- data/scss/library/_index.scss +58 -0
- data/scss/library/_line-clamp.scss +38 -0
- data/scss/library/_linear-gradient.scss +33 -0
- data/scss/library/_loadify.scss +62 -0
- data/scss/library/_motion-safe.scss +28 -0
- data/scss/library/_only.scss +73 -0
- data/scss/library/_placeholder-shown.scss +7 -0
- data/scss/library/_placeholder.scss +19 -0
- data/scss/library/_position.scss +72 -0
- data/scss/library/_radial-gradient.scss +184 -0
- data/scss/library/_remove.scss +40 -0
- data/scss/library/_reset-css.scss +57 -0
- data/scss/library/_reset-figure.scss +10 -0
- data/scss/library/_resizable.scss +34 -0
- data/scss/library/_responsive-image.scss +6 -0
- data/scss/library/_scissors.scss +34 -0
- data/scss/library/_screen-agent.scss +34 -0
- data/scss/library/_sizer.scss +15 -0
- data/scss/library/_smartphone.scss +29 -0
- data/scss/library/_sprite.scss +100 -0
- data/scss/library/_stretched-link.scss +21 -0
- data/scss/library/_tablet.scss +29 -0
- data/scss/library/_text-gradient.scss +38 -0
- data/scss/library/_text-image.scss +15 -0
- data/scss/library/_text-selection.scss +22 -0
- data/scss/library/_text-shadow.scss +145 -0
- data/scss/library/_text-stroke.scss +43 -0
- data/scss/library/_tokens.scss +111 -0
- data/scss/library/_triangle.scss +115 -0
- data/scss/lists/_index.scss +8 -0
- data/scss/lists/_list-of-anchor-pseudo-classes.scss +9 -0
- data/scss/lists/_list-of-buttons.scss +8 -0
- data/scss/lists/_list-of-counter-styles.scss +59 -0
- data/scss/lists/_list-of-directions.scss +12 -0
- data/scss/lists/_list-of-length-units.scss +23 -0
- data/scss/lists/_list-of-text-inputs.scss +20 -0
- data/scss/maps/_index.scss +8 -0
- data/scss/maps/_map-for-breakpoints.scss +9 -0
- data/scss/maps/_map-for-directions.scss +12 -0
- data/scss/maps/_map-for-font-formats.scss +9 -0
- data/scss/maps/_map-for-positions.scss +13 -0
- data/scss/maps/_map-for-smartphones.scss +72 -0
- data/scss/maps/_map-for-tablets.scss +32 -0
- data/scss/utilities/_clear-unit.scss +11 -0
- data/scss/utilities/_clear-whitespace.scss +15 -0
- data/scss/utilities/_convert-to-em.scss +16 -0
- data/scss/utilities/_convert-to-number.scss +45 -0
- data/scss/utilities/_fill-nulls.scss +18 -0
- data/scss/utilities/_fluid.scss +76 -0
- data/scss/utilities/_font-sizer.scss +19 -0
- data/scss/utilities/_font-source.scss +23 -0
- data/scss/utilities/_index.scss +25 -0
- data/scss/utilities/_is-color.scss +16 -0
- data/scss/utilities/_is-gutter.scss +24 -0
- data/scss/utilities/_is-number.scss +11 -0
- data/scss/utilities/_is-time.scss +14 -0
- data/scss/utilities/_map-deep-get.scss +10 -0
- data/scss/utilities/_pixelify.scss +20 -0
- data/scss/utilities/_pseudo-selector.scss +12 -0
- data/scss/utilities/_remify.scss +16 -0
- data/scss/utilities/_shade.scss +10 -0
- data/scss/utilities/_shorthand-property.scss +17 -0
- data/scss/utilities/_tint.scss +10 -0
- data/scss/utilities/_validate-breakpoint.scss +41 -0
- data/scss/utilities/_validate-length.scss +37 -0
- data/scss/utilities/_validate-ratio.scss +77 -0
- data/scss/utilities/_validate-scissors.scss +34 -0
- metadata +130 -46
- data/core/_gerillass.scss +0 -4
- data/core/library/_before.scss +0 -18
- data/core/library/_border-box.scss +0 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02dd270ee370fad4ffe2c7c923109a817dad1f57ad146c0797f1af0294eed964
|
|
4
|
+
data.tar.gz: 4b8401c4dcd34999ef807ce113245569ba46851b9681d310013aab6b22ac0aea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d4787002cda44ffba63f6bc24b14b0651003e0480d50f361a280c2500deef566c94b351e0207750cb92a059e8cc99e97cd59c63cdd054e9b340692b9e436a5c
|
|
7
|
+
data.tar.gz: 98c62d1bb1d0d3b04b3eb6529ef9fa74893ca197775633cb57a53229011b1407ac5e30c40126ba4c5bd720f5fdb4bf7ca5060c35a6be61aa7641f52376058aac
|
data/LICENSE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2020 [Halil İbrahim Çakıroğlu](https://www.linkedin.com/in/selfishprimate/)
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
<p>
|
|
2
|
+
<a href="https://gerillass.com" target="_blank">
|
|
3
|
+
<img src="https://gerillass.com/images/github/gerillass_logo_sassy.svg">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
## _<span><img src="https://gerillass.com/images/github/heart_red.svg"></span> Meet the Coolest Sass Toolset! <span><img src="https://gerillass.com/images/github/heart_red.svg"></span>_
|
|
8
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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.
|
|
14
|
+
|
|
15
|
+
Hope you’ll enjoy using it!
|
|
16
|
+
|
|
17
|
+
**Related Links:**
|
|
18
|
+
|
|
19
|
+
- [Gerillass Website](https://gerillass.com)
|
|
20
|
+
- [Gerillass Documentation](https://docs.gerillass.com)
|
|
21
|
+
- [Gerillass Blog](https://medium.com/gerillass)
|
|
22
|
+
- [Twitter](https://twitter.com/gerillass)
|
|
23
|
+
|
|
24
|
+
## Table of Contents
|
|
25
|
+
|
|
26
|
+
- [Dart Sass Upgrade](#dart-sass-upgrade)
|
|
27
|
+
- [Installation](#installation)
|
|
28
|
+
- [Using with Vite](#using-with-vite)
|
|
29
|
+
- [Using with webpack](#using-with-webpack)
|
|
30
|
+
- [Using with Parcel](#using-with-parcel)
|
|
31
|
+
- [Using with Next.js](#using-with-nextjs)
|
|
32
|
+
- [Using with Angular](#using-with-angular)
|
|
33
|
+
- [Using with Gulp](#using-with-gulp)
|
|
34
|
+
- [Using with Grunt](#using-with-grunt)
|
|
35
|
+
- [Using with Ruby: Rails, Jekyll, or plain Sass](#using-with-ruby-rails-jekyll-or-plain-sass)
|
|
36
|
+
- [Cloning the Repository from Github](#cloning-the-repository-from-github)
|
|
37
|
+
- [Versions these examples were tested with](#versions-these-examples-were-tested-with)
|
|
38
|
+
- [Using Gerillass with an AI coding agent](#using-gerillass-with-an-ai-coding-agent)
|
|
39
|
+
- [Three ways to call the same mixin](#three-ways-to-call-the-same-mixin)
|
|
40
|
+
- [Vendor Prefix Support](#vendor-prefix-support)
|
|
41
|
+
- [Experimenting](#experimenting)
|
|
42
|
+
- [Testing](#testing)
|
|
43
|
+
- [Contribution](#contribution)
|
|
44
|
+
- [License](#license)
|
|
45
|
+
- [Additional Info](#additional-info)
|
|
46
|
+
|
|
47
|
+
## Dart Sass Upgrade
|
|
48
|
+
_We are saying goodbye to LibSass with version 1.3.0_ :cry:
|
|
49
|
+
|
|
50
|
+
Because LibSass and the packages built on it, including Node Sass, are deprecated, **Gerillass will no longer support LibSass since version 1.3.0** If you're having a problem running Gerillass v1.3.0 please consider using Dart Sass instead of LibSass. If you are running Dart Sass already, you can install and use Gerillass 1.3.0 and later versions safely. If not, however, please use the earlier versions.
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
npm install gerillass --save-dev
|
|
55
|
+
|
|
56
|
+
Or with Yarn:
|
|
57
|
+
|
|
58
|
+
yarn add gerillass --dev
|
|
59
|
+
|
|
60
|
+
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:
|
|
61
|
+
|
|
62
|
+
@use 'gerillass' as *;
|
|
63
|
+
|
|
64
|
+
If you call Dart Sass yourself rather than through a bundler, turn on its package importer and use a `pkg:` URL:
|
|
65
|
+
|
|
66
|
+
@use 'pkg:gerillass' as *;
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
// Dart Sass 1.71.0 or later
|
|
70
|
+
import * as sass from 'sass';
|
|
71
|
+
import { NodePackageImporter } from 'sass';
|
|
72
|
+
|
|
73
|
+
sass.compile('style.scss', { importers: [new NodePackageImporter()] });
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Or from the command line:
|
|
77
|
+
|
|
78
|
+
sass --pkg-importer=node style.scss style.css
|
|
79
|
+
|
|
80
|
+
Pointing straight at the file always works too:
|
|
81
|
+
|
|
82
|
+
@use '{node_modules_path}/gerillass/scss/gerillass' as *;
|
|
83
|
+
|
|
84
|
+
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.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
### Using with Vite
|
|
88
|
+
|
|
89
|
+
Vite resolves the package by name, so there is nothing to configure. This covers anything built on Vite, including React, Vue, Svelte, SvelteKit and Astro.
|
|
90
|
+
|
|
91
|
+
@use 'gerillass' as *;
|
|
92
|
+
|
|
93
|
+
### Using with webpack
|
|
94
|
+
|
|
95
|
+
`sass-loader` also resolves the package by name, with no extra options.
|
|
96
|
+
|
|
97
|
+
@use 'gerillass' as *;
|
|
98
|
+
|
|
99
|
+
### Using with Parcel
|
|
100
|
+
|
|
101
|
+
Parcel resolves the package by name too, so the usual line needs no configuration:
|
|
102
|
+
|
|
103
|
+
@use 'gerillass' as *;
|
|
104
|
+
|
|
105
|
+
**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:
|
|
106
|
+
|
|
107
|
+
"targets": { "main": false }
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
111
|
+
// .sassrc.js
|
|
112
|
+
const { NodePackageImporter } = require("sass");
|
|
113
|
+
module.exports = { importers: [new NodePackageImporter()] };
|
|
114
|
+
|
|
115
|
+
Two more things worth knowing:
|
|
116
|
+
|
|
117
|
+
- **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.
|
|
118
|
+
- **`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.
|
|
119
|
+
|
|
120
|
+
### Using with Next.js
|
|
121
|
+
|
|
122
|
+
Next.js needs to be told where the library lives. In `next.config.mjs`:
|
|
123
|
+
|
|
124
|
+
export default {
|
|
125
|
+
sassOptions: {
|
|
126
|
+
loadPaths: ["node_modules/gerillass/scss"],
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
Then, in any `.scss` file:
|
|
131
|
+
|
|
132
|
+
@use 'gerillass' as *;
|
|
133
|
+
|
|
134
|
+
### Using with Angular
|
|
135
|
+
|
|
136
|
+
Add the library folder to the build target's options in `angular.json`. Angular calls this option `includePaths`, not `loadPaths`:
|
|
137
|
+
|
|
138
|
+
"stylePreprocessorOptions": {
|
|
139
|
+
"includePaths": ["node_modules/gerillass/scss"]
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
Then, in `src/styles.scss`:
|
|
143
|
+
|
|
144
|
+
@use 'gerillass' as *;
|
|
145
|
+
|
|
146
|
+
### Using with Gulp
|
|
147
|
+
|
|
148
|
+
`gulp-sass` hands its options straight to Dart Sass, so the option is **`loadPaths`**. The old `includePaths` name came from Node Sass and no longer resolves.
|
|
149
|
+
|
|
150
|
+
const { src, dest } = require("gulp");
|
|
151
|
+
const sass = require("gulp-sass")(require("sass"));
|
|
152
|
+
|
|
153
|
+
function styles() {
|
|
154
|
+
return src("assets/sass/**/*.scss")
|
|
155
|
+
.pipe(sass({ loadPaths: ["node_modules/gerillass/scss"] }).on("error", sass.logError))
|
|
156
|
+
.pipe(dest("assets/css"));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
exports.styles = styles;
|
|
160
|
+
|
|
161
|
+
Then:
|
|
162
|
+
|
|
163
|
+
@use 'gerillass' as *;
|
|
164
|
+
|
|
165
|
+
### Using with Grunt
|
|
166
|
+
|
|
167
|
+
Use `grunt-sass` with Dart Sass as the implementation. The option here is **`loadPaths`** as well, not `loadPath`, and not `includePaths`.
|
|
168
|
+
|
|
169
|
+
module.exports = function (grunt) {
|
|
170
|
+
grunt.loadNpmTasks("grunt-sass");
|
|
171
|
+
grunt.initConfig({
|
|
172
|
+
sass: {
|
|
173
|
+
dist: {
|
|
174
|
+
options: {
|
|
175
|
+
implementation: require("sass"),
|
|
176
|
+
loadPaths: ["node_modules/gerillass/scss"],
|
|
177
|
+
},
|
|
178
|
+
files: { "css/main.css": "src/main.scss" },
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
Then:
|
|
185
|
+
|
|
186
|
+
@use 'gerillass' as *;
|
|
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
|
+
|
|
217
|
+
### Cloning the repository from Github
|
|
218
|
+
|
|
219
|
+
You can clone the repository into your local computer from Github.
|
|
220
|
+
|
|
221
|
+
git clone https://github.com/selfishprimate/gerillass.git
|
|
222
|
+
|
|
223
|
+
Or you can add the library as a submodule into your Git based project ([What is a submodule?](https://git-scm.com/book/en/v2/Git-Tools-Submodules)).
|
|
224
|
+
|
|
225
|
+
git submodule add https://github.com/selfishprimate/gerillass.git
|
|
226
|
+
|
|
227
|
+
Including to the project:
|
|
228
|
+
|
|
229
|
+
@use '{folder_path}/gerillass/scss/gerillass' as *;
|
|
230
|
+
|
|
231
|
+
### Versions these examples were tested with
|
|
232
|
+
|
|
233
|
+
| Tool | Version |
|
|
234
|
+
|---|---|
|
|
235
|
+
| Dart Sass | 1.103.1 |
|
|
236
|
+
| Vite | 8.2.2 |
|
|
237
|
+
| webpack / sass-loader | 5.110.3 / 17.0.1 |
|
|
238
|
+
| Next.js | 16.3.4 |
|
|
239
|
+
| Angular CLI | 20.3.36 |
|
|
240
|
+
| Gulp / gulp-sass | 5.0.1 / 6.0.1 |
|
|
241
|
+
| Grunt / grunt-sass | 1.6.3 / 4.1.0 |
|
|
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 |
|
|
248
|
+
|
|
249
|
+
## Using Gerillass with an AI coding agent
|
|
250
|
+
|
|
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.
|
|
252
|
+
|
|
253
|
+
**`gerillass.json`** describes every mixin and function: its signature, what each argument accepts, examples that compile, and inputs that are refused.
|
|
254
|
+
|
|
255
|
+
const api = require("gerillass/gerillass.json");
|
|
256
|
+
|
|
257
|
+
**`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:
|
|
258
|
+
|
|
259
|
+
mkdir -p .claude/skills/gerillass
|
|
260
|
+
cp node_modules/gerillass/SKILL.md .claude/skills/gerillass/
|
|
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
|
+
|
|
266
|
+
Otherwise, point your agent at the file and it will read it as plain Markdown.
|
|
267
|
+
|
|
268
|
+
### Why you can trust what they say
|
|
269
|
+
|
|
270
|
+
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.
|
|
271
|
+
|
|
272
|
+
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.
|
|
273
|
+
|
|
274
|
+
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.
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
## Three ways to call the same mixin
|
|
278
|
+
|
|
279
|
+
None of them is required. Pick whichever reads best in your project, and stay with it in a given file.
|
|
280
|
+
|
|
281
|
+
**Bare.** The shortest, and fine unless another library defines the same name.
|
|
282
|
+
|
|
283
|
+
@use 'gerillass' as *;
|
|
284
|
+
.avatar { @include circle(50px); }
|
|
285
|
+
|
|
286
|
+
**With the `gls-` prefix.** Every mixin also answers to a prefixed name, which avoids collisions with Bootstrap and friends.
|
|
287
|
+
|
|
288
|
+
@use 'gerillass' as *;
|
|
289
|
+
.avatar { @include gls-circle(50px); }
|
|
290
|
+
|
|
291
|
+
**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.
|
|
292
|
+
|
|
293
|
+
@use 'gerillass' as gls;
|
|
294
|
+
.avatar { @include gls.circle(50px); }
|
|
295
|
+
|
|
296
|
+
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.
|
|
297
|
+
|
|
298
|
+
## Vendor Prefix Support
|
|
299
|
+
|
|
300
|
+
Because of the vast usage of bundlers like [Gulp](https://gulpjs.com/), [Grunt](https://gruntjs.com/), [Webpack](https://webpack.js.org/), etc.(these frameworks run some other plugins like Autoprefixer to support vendor prefixes), Gerillass doesn't provide vendor prefix support.
|
|
301
|
+
|
|
302
|
+
So, feel free to use any tool to support that. My suggestion is Autoprefixer. If you are not using one of the bundlers mentioned above, you can also manually add vendor prefixes using the [Autoprefixer CSS Online](https://autoprefixer.github.io/) tool.
|
|
303
|
+
|
|
304
|
+
## Experimenting
|
|
305
|
+
|
|
306
|
+
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.
|
|
307
|
+
|
|
308
|
+
**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.
|
|
309
|
+
|
|
310
|
+
## Testing
|
|
311
|
+
|
|
312
|
+
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)).
|
|
313
|
+
|
|
314
|
+
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.
|
|
315
|
+
|
|
316
|
+
npm test
|
|
317
|
+
|
|
318
|
+
## Contribution
|
|
319
|
+
|
|
320
|
+
Please read the [contribution details](CONTRIBUTING.md) and feel free to contribute to the library.
|
|
321
|
+
|
|
322
|
+
## License
|
|
323
|
+
|
|
324
|
+
Gerillass is licensed under the Apache License, Version 2.0. For more [see the license content](https://github.com/selfishprimate/gerillass/blob/main/LICENSE.md).
|
|
325
|
+
|
|
326
|
+
## Additional Info
|
|
327
|
+
|
|
328
|
+
This project is created with the loving music of **Anna German** and dedicated to **James Williamson**: The best web educator ever. For more information about James, please check his legacy blog page at [simpleprimate.netlify.app](https://simpleprimate.netlify.app) or watch his video lectures about **Web** and **Accessibility** on [LinkedIn Learning](https://www.linkedin.com/learning/instructors/james-williamson).
|
data/SKILL.md
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gerillass
|
|
3
|
+
description: Use the Gerillass Sass mixin library — loading it, the mixin catalogue, and the argument forms that are easy to get wrong. Use when writing SCSS in a project that has gerillass installed.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Gerillass
|
|
7
|
+
|
|
8
|
+
A Sass mixin library: 56 mixins and 23 functions that emit CSS from
|
|
9
|
+
semantic declarations. It is Sass source only — there is no runtime and no
|
|
10
|
+
utility classes, so styles live in your stylesheet and your markup stays clean.
|
|
11
|
+
|
|
12
|
+
Full documentation: https://docs.gerillass.com
|
|
13
|
+
Machine-readable API: `gerillass.json` in this package.
|
|
14
|
+
|
|
15
|
+
## Loading it
|
|
16
|
+
|
|
17
|
+
Through a bundler (Vite, webpack and most others resolve the package by name):
|
|
18
|
+
|
|
19
|
+
```scss
|
|
20
|
+
@use "gerillass" as *;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Calling Dart Sass yourself, with its package importer
|
|
24
|
+
(`new NodePackageImporter()` or `sass --pkg-importer=node`):
|
|
25
|
+
|
|
26
|
+
```scss
|
|
27
|
+
@use "pkg:gerillass" as *;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Anything else, by pointing a load path at `node_modules/gerillass/scss`:
|
|
31
|
+
|
|
32
|
+
```scss
|
|
33
|
+
@use "gerillass" as *;
|
|
34
|
+
```
|
|
35
|
+
|
|
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.
|
|
47
|
+
|
|
48
|
+
## Two names for every mixin
|
|
49
|
+
|
|
50
|
+
Every mixin exists twice: bare (`circle`) and prefixed (`gls-circle`).
|
|
51
|
+
They are the same mixin. The prefix exists to avoid collisions with other
|
|
52
|
+
libraries. Pick one and stay with it; do not mix them in a file.
|
|
53
|
+
|
|
54
|
+
With the module system you can namespace instead, which is usually cleaner:
|
|
55
|
+
|
|
56
|
+
```scss
|
|
57
|
+
@use "gerillass" as gls;
|
|
58
|
+
.avatar { @include gls.circle(50px); }
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Getting arguments right
|
|
62
|
+
|
|
63
|
+
The conventions are not uniform across the library, so check before guessing.
|
|
64
|
+
A mixin that wants a string will not take a bare value:
|
|
65
|
+
|
|
66
|
+
```scss
|
|
67
|
+
.a { @include after(42) { color: red; } } // wrong — errors
|
|
68
|
+
.a { @include after("→") { color: red; } } // right
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Mixins that reject bad input do so with a message naming what they accept. If
|
|
72
|
+
you get one, read it: it lists the valid values. Mixins not in the table below
|
|
73
|
+
mostly pass their arguments through to CSS, so a wrong value there shows up as
|
|
74
|
+
a dropped declaration rather than an error.
|
|
75
|
+
|
|
76
|
+
| Mixin | Rejects, for example |
|
|
77
|
+
|---|---|
|
|
78
|
+
| `adaptive` | `.wrap { @include adaptive(auto); }` |
|
|
79
|
+
| `after` | `.a { @include after(42) { color: red; } }` |
|
|
80
|
+
| `all-buttons` | `@include all-buttons(nonsense) { color: red; }` |
|
|
81
|
+
| `all-text-inputs` | `@include all-text-inputs(nonsense) { color: red; }` |
|
|
82
|
+
| `antialias` | `@include antialias(only);` |
|
|
83
|
+
| `aspect-ratio` | `.thumb { @include aspect-ratio("16:9", nonsense); }` |
|
|
84
|
+
| `background-dots` | `.a { @include background-dots(red, 1em, 5em, maybe); }` |
|
|
85
|
+
| `background-image` | `.a { @include background-image("/img/a.png", (red, blue), sideways); }` |
|
|
86
|
+
| `background-stripes` | `.a { @include background-stripes(red, 2em, nonsense); }` |
|
|
87
|
+
| `before` | `.a { @include before(42) { color: red; } }` |
|
|
88
|
+
| `border-box` | `@include border-box(only);` |
|
|
89
|
+
| `border-radius` | `.a { @include border-radius(1px, 2px, 3px); }` |
|
|
90
|
+
| `brand-logo` | `.logo { @include brand-logo(120px, 40px, "/img/a.svg" "/img/b.svg"); }` |
|
|
91
|
+
| `breakpoint` | `.a { @include breakpoint("between", "medium", "large") { color: red; } }` |
|
|
92
|
+
| `breakpointer` | `.a { @include breakpointer(42); }` |
|
|
93
|
+
| `center` | `.modal { @include center(diagonal); }` |
|
|
94
|
+
| `circle` | `.dot { @include circle(huge); }` |
|
|
95
|
+
| `columnizer` | `.grid { @include columnizer(3, 20px, true, 9); }` |
|
|
96
|
+
| `container-query` | `.title { @include container-query("min", 400px, 800px) { color: red; } }` |
|
|
97
|
+
| `container` | `.card { @include container("card", sideways); }` |
|
|
98
|
+
| `ellipsis` | `.a { @include ellipsis(100%, huge); }` |
|
|
99
|
+
| `escape-to-parent` | `.a { @include escape-to-parent(42) { color: red; } }` |
|
|
100
|
+
| `except` | `.a { @include except(#ff0000) { margin: 0; } }` |
|
|
101
|
+
| `focus-ring` | `@include focus-ring;` |
|
|
102
|
+
| `font-face` | `.a { @include font-face("Inter", "/fonts/inter"); }` |
|
|
103
|
+
| `hide` | `.a { @include hide(nonsense); }` |
|
|
104
|
+
| `line-clamp` | `.a { @include line-clamp(0); }` |
|
|
105
|
+
| `linear-gradient` | `.a { @include linear-gradient(sideways, (red, blue)); }` |
|
|
106
|
+
| `loadify` | `@include loadify(nonsense);` |
|
|
107
|
+
| `motion-safe` | `.card { @include motion-safe; }` |
|
|
108
|
+
| `only` | `.a { @include only(#ff0000) { margin: 0; } }` |
|
|
109
|
+
| `position` | `.badge { @include position(absolute, 0, $logical: yes); }` |
|
|
110
|
+
| `radial-gradient` | `.a { @include radial-gradient(42, "center", (red, blue)); }` |
|
|
111
|
+
| `remove` | `.a { @include remove(a, b, c); }` |
|
|
112
|
+
| `reset-css` | `.a { @include reset-css; }` |
|
|
113
|
+
| `resizable` | `.a { @include resizable(huge); }` |
|
|
114
|
+
| `scissors` | `.a { @include scissors(5px 10px); }` |
|
|
115
|
+
| `screen-agent` | `.a { @include screen-agent(var(--density)) { color: red; } }` |
|
|
116
|
+
| `sizer` | `.a { @include sizer(huge); }` |
|
|
117
|
+
| `smartphone` | `.a { @include smartphone(Nokia3310) { display: none; } }` |
|
|
118
|
+
| `sprite` | `.icon { @include sprite("/img/sprite.txt"); }` |
|
|
119
|
+
| `stretched-link` | `.card a { @include stretched-link(middle); }` |
|
|
120
|
+
| `tablet` | `.a { @include tablet(Surface) { display: none; } }` |
|
|
121
|
+
| `text-gradient` | `.a { @include text-gradient(sideways, (red, blue)); }` |
|
|
122
|
+
| `text-image` | `.a { @include text-image(16 9); }` |
|
|
123
|
+
| `text-selection` | `.a { @include text-selection(bogus) { background: yellow; } }` |
|
|
124
|
+
| `text-shadow` | `.a { @include text-shadow(42); }` |
|
|
125
|
+
| `text-stroke` | `.a { @include text-stroke(huge); }` |
|
|
126
|
+
| `tokens` | `:root { @include tokens(#fff); }` |
|
|
127
|
+
| `triangle` | `.caret { @include triangle(sideways); }` |
|
|
128
|
+
|
|
129
|
+
## Traps a signature does not show
|
|
130
|
+
|
|
131
|
+
**`after`**
|
|
132
|
+
|
|
133
|
+
- With no argument no `content` is emitted, so the pseudo-element does not render unless the block sets `content`. Pass `""` for an empty one.
|
|
134
|
+
|
|
135
|
+
**`aspect-ratio`**
|
|
136
|
+
|
|
137
|
+
- 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.
|
|
138
|
+
|
|
139
|
+
**`before`**
|
|
140
|
+
|
|
141
|
+
- With no argument no `content` is emitted, so the pseudo-element does not render unless the block sets `content`. Pass `""` for an empty one.
|
|
142
|
+
|
|
143
|
+
**`breakpoint`**
|
|
144
|
+
|
|
145
|
+
- 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.
|
|
146
|
+
- Declarations written after the include, in the same rule, are emitted after the `@media` block and win over it. Write them before the include.
|
|
147
|
+
|
|
148
|
+
**`container-query`**
|
|
149
|
+
|
|
150
|
+
- 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.
|
|
151
|
+
|
|
152
|
+
**`container`**
|
|
153
|
+
|
|
154
|
+
- An element does not match a `@container` query that reads its own container, and nothing warns. Put the `container-query` on a descendant.
|
|
155
|
+
|
|
156
|
+
**`counter`**
|
|
157
|
+
|
|
158
|
+
- 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.
|
|
159
|
+
|
|
160
|
+
**`except`**
|
|
161
|
+
|
|
162
|
+
- An+B with an offset cannot be passed as a number: Sass does the arithmetic, so `except(2n+1)` becomes `3n` and excludes every third element, not the odd ones. Use `odd` or `even`, or a coefficient alone such as `3n`.
|
|
163
|
+
|
|
164
|
+
**`loadify`**
|
|
165
|
+
|
|
166
|
+
- `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".
|
|
167
|
+
|
|
168
|
+
**`motion-safe`**
|
|
169
|
+
|
|
170
|
+
- Keep the resting state outside the block. An element hidden in its base rule and revealed by an animation inside the block stays hidden for a user who asked for less motion; put the start state in the keyframes instead.
|
|
171
|
+
|
|
172
|
+
**`only`**
|
|
173
|
+
|
|
174
|
+
- An+B with an offset cannot be passed as a number: Sass does the arithmetic, so `only(2n+1)` becomes `3n` and selects every third element, not the odd ones. Use `odd` or `even`, or a coefficient alone such as `3n`.
|
|
175
|
+
|
|
176
|
+
**`remove`**
|
|
177
|
+
|
|
178
|
+
- 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.
|
|
179
|
+
- 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.
|
|
180
|
+
|
|
181
|
+
## Mixins
|
|
182
|
+
|
|
183
|
+
| Signature | What it does |
|
|
184
|
+
|---|---|
|
|
185
|
+
| `adaptive($gutter: 30px)` | Centred container whose max-width steps up at every breakpoint. |
|
|
186
|
+
| `after($content: null)` | Styles the ::after pseudo-element. A `data-` argument becomes an attr() content value. |
|
|
187
|
+
| `all-buttons($pseudo: null)` | Targets every button-like element at once, optionally in one pseudo-class state. |
|
|
188
|
+
| `all-text-inputs($pseudo: null)` | Targets every text-like input at once, optionally in one pseudo-class state. |
|
|
189
|
+
| `antialias($value: null)` | Turns on subpixel-antialiased text smoothing. |
|
|
190
|
+
| `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. |
|
|
191
|
+
| `background-dots($color: null, $size: 1em, $gutter: null, $diagonal: true, $image: null)` | Repeating dot pattern as a background, optionally over an image. |
|
|
192
|
+
| `background-image($image-url: null, $filter-color: null, $filter-direction: null)` | Background image with an optional colour or gradient filter laid over it. |
|
|
193
|
+
| `background-stripes($color: null, $thickness: 1em, $rotation: -45deg, $image: null)` | Repeating stripe pattern as a background, optionally over an image. |
|
|
194
|
+
| `before($content: null)` | Styles the ::before pseudo-element. A `data-` argument becomes an attr() content value. |
|
|
195
|
+
| `border-box($value: null)` | Applies box-sizing: border-box. |
|
|
196
|
+
| `border-radius($args...)` | Rounds corners, either all of them, one named corner, or all four individually. |
|
|
197
|
+
| `brand-logo($width, $height, $image-url: null)` | Logo box with an image and an accessible stretched link over it. |
|
|
198
|
+
| `breakpoint($params...)` | Media query built from the breakpoint map, or from raw lengths. |
|
|
199
|
+
| `breakpointer($selector: null)` | Debug helper that prints the active breakpoint name into a pseudo-element. |
|
|
200
|
+
| `center($axis: "both")` | Absolutely centres an element inside its positioned parent. |
|
|
201
|
+
| `circle($size)` | Square element with a fully rounded border, i.e. a circle. |
|
|
202
|
+
| `clearfix` | Clears floated children using an ::after pseudo-element. |
|
|
203
|
+
| `columnizer($params...)` | Flexbox grid of equal columns, with an optional gutter and fill behaviour. |
|
|
204
|
+
| `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. |
|
|
205
|
+
| `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. |
|
|
206
|
+
| `counter($params...)` | CSS counter for a list, with optional text before and after the number. |
|
|
207
|
+
| `ellipsis($width: 100%, $display: inline-block)` | Truncates a single line of text with an ellipsis. |
|
|
208
|
+
| `escape-to-parent($selector: null)` | Re-roots the current selector under another one using @at-root. |
|
|
209
|
+
| `except($params...)` | Selects every sibling except the ones named. |
|
|
210
|
+
| `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. |
|
|
211
|
+
| `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. |
|
|
212
|
+
| `hide($toggle: "hide")` | Visually hides an element while keeping it available to screen readers, or reverses that. |
|
|
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. |
|
|
214
|
+
| `linear-gradient($direction, $colors)` | Linear gradient background from a direction name or an angle. |
|
|
215
|
+
| `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. |
|
|
216
|
+
| `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. |
|
|
217
|
+
| `only($params...)` | Selects only the siblings named. |
|
|
218
|
+
| `placeholder-shown` | Styles an input while its placeholder is visible. |
|
|
219
|
+
| `placeholder` | Styles the placeholder text of an input across vendor prefixes. |
|
|
220
|
+
| `position($position: absolute, $offsets: 0, $logical: false)` | Sets position and offsets in one call, using shorthand order. |
|
|
221
|
+
| `radial-gradient($shape, $position, $colors)` | Radial gradient background from a shape and a position. |
|
|
222
|
+
| `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. |
|
|
223
|
+
| `reset-css` | Meyer reset. Must be called at the root of the stylesheet. |
|
|
224
|
+
| `reset-figure` | Removes default figure margins and makes the image inside responsive. |
|
|
225
|
+
| `resizable($direction: both, $overflow: auto)` | Makes an element user-resizable. |
|
|
226
|
+
| `responsive-image` | Makes an image fill its container width. |
|
|
227
|
+
| `scissors($corners)` | Cuts the corners off an element with clip-path. |
|
|
228
|
+
| `screen-agent($resolution)` | Media query targeting a screen pixel density. |
|
|
229
|
+
| `sizer($width, $height: $width)` | Sets width and height together; one argument makes a square. |
|
|
230
|
+
| `smartphone($device, $orientation: null)` | Media query targeting a known smartphone by device dimensions. |
|
|
231
|
+
| `sprite($params...)` | Sets up an element as a sprite tile: an image, a background position, or both. |
|
|
232
|
+
| `stretched-link($value: "before")` | Expands a link to cover its positioned parent, so the whole card is clickable. |
|
|
233
|
+
| `tablet($device, $orientation: null)` | Media query targeting a known tablet by device dimensions. |
|
|
234
|
+
| `text-gradient($direction, $colors)` | Applies a linear gradient to the text itself via background-clip. |
|
|
235
|
+
| `text-image($image: null)` | Fills the text with an image via background-clip. |
|
|
236
|
+
| `text-selection($value: null)` | Styles the ::selection pseudo-element. |
|
|
237
|
+
| `text-shadow($params...)` | Layered text shadows built from a direction, a colour and an offset. |
|
|
238
|
+
| `text-stroke($fallback-color: black, $color: transparent, $stroke-color: black, $stroke-width: 1px)` | Outlines text using the webkit text-stroke properties. |
|
|
239
|
+
| `tokens($map, $prefix: null)` | Writes a Sass map out as CSS custom properties, for any kind of token: colours, spacing, sizes, radii, type, shadows, durations. With the prefix space, (4: 1rem) becomes --space-4: 1rem. A null value is skipped, and a quoted string keeps its quotes. |
|
|
240
|
+
| `triangle($direction: "bottom", $color: black, $size: 10px 8px)` | Draws a CSS triangle out of borders, pointing in a given direction. |
|
|
241
|
+
|
|
242
|
+
## Functions
|
|
243
|
+
|
|
244
|
+
Called like normal Sass functions, with no `@include`. They are public API,
|
|
245
|
+
and camelCase is what tells them apart from the kebab-case mixins above.
|
|
246
|
+
|
|
247
|
+
| Signature | What it does |
|
|
248
|
+
|---|---|
|
|
249
|
+
| `clearUnit($value)` | Strips the unit off a number, returning it unitless. |
|
|
250
|
+
| `clearWhitespace($string)` | Removes every space from a string. |
|
|
251
|
+
| `convertToEm($value)` | Converts a pixel length to em, against a 16px base. |
|
|
252
|
+
| `convertToNumber($value)` | Parses a string of digits into a number. |
|
|
253
|
+
| `fillNulls($value, $seperation: comma, $skip: false)` | Replaces null entries in a list with 0, or drops them. |
|
|
254
|
+
| `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. |
|
|
255
|
+
| `fontSizer($size, $time)` | Multiplies a size by a factor. Handy for a modular scale. |
|
|
256
|
+
| `fontSource($font-family, $file-path, $file-formats)` | Builds one src entry for an @font-face rule. |
|
|
257
|
+
| `isColor($value)` | Returns the value if every item in it is a colour, and errors otherwise. |
|
|
258
|
+
| `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(). |
|
|
259
|
+
| `isNumber($value)` | Returns the value if it is a number. |
|
|
260
|
+
| `isTime($value)` | Returns the value if it is a time in s or ms, and errors otherwise. |
|
|
261
|
+
| `mapDeepGet($map, $keys...)` | Reads a value out of a nested map by following a chain of keys. |
|
|
262
|
+
| `pixelify($value)` | Returns the value with a px unit, adding one if it is missing. |
|
|
263
|
+
| `pseudoSelector($elements, $pseudo: null)` | Appends a pseudo-class to every selector in a list. |
|
|
264
|
+
| `remify($value)` | Converts a pixel length to rem, against a 16px root. |
|
|
265
|
+
| `shade($color, $percentage)` | Mixes a colour towards black by a percentage. |
|
|
266
|
+
| `shorthandProperty($value)` | Expands one to four values into the four-value CSS shorthand order. |
|
|
267
|
+
| `tint($color, $percentage)` | Mixes a colour towards white by a percentage. |
|
|
268
|
+
| `validateBreakpoint($value)` | Resolves a breakpoint name to its width, passing a length, a percentage or a CSS function through, and refusing a word that is not a key. |
|
|
269
|
+
| `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. |
|
|
270
|
+
| `validateRatio($ratio)` | Turns an aspect ratio into a value for the CSS aspect-ratio property. |
|
|
271
|
+
| `validateScissors($value)` | Normalises corner values for the scissors mixin, adding px where missing. |
|
|
272
|
+
|
|
273
|
+
## Checking your work
|
|
274
|
+
|
|
275
|
+
Sass evaluates mixin bodies lazily, so a stylesheet that merely loads the
|
|
276
|
+
library always compiles. Compile the file that actually calls the mixin:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
sass --load-path=node_modules/gerillass/scss your.scss
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
An empty rule in the output means the mixin matched none of its branches —
|
|
283
|
+
treat that as a bug, not as success.
|