gerillass 1.4.0 → 1.6.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 +109 -50
- package/SKILL.md +189 -0
- package/gerillass.json +1869 -0
- package/package.json +12 -1
- package/scss/_gerillass-prefix.scss +48 -9
- package/scss/library/_all-buttons.scss +1 -1
- package/scss/library/_all-text-inputs.scss +1 -1
- package/scss/library/_antialias.scss +4 -0
- package/scss/library/_background-dots.scss +3 -0
- package/scss/library/_background-image.scss +2 -2
- package/scss/library/_border-box.scss +4 -0
- package/scss/library/_border-radius.scss +3 -1
- package/scss/library/_center.scss +3 -0
- package/scss/library/_columnizer.scss +5 -0
- package/scss/library/_except.scss +2 -0
- package/scss/library/_only.scss +2 -0
- package/scss/library/_remove.scss +1 -1
- package/scss/library/_scissors.scss +2 -0
- package/scss/library/_smartphone.scss +3 -1
- package/scss/library/_sprite.scss +4 -0
- package/scss/library/_tablet.scss +3 -1
- package/scss/library/_text-selection.scss +4 -0
- package/scss/library/_triangle.scss +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
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
|
-
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://
|
|
11
|
+
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
12
|
|
|
13
13
|
Hope you’ll enjoy using it!
|
|
14
14
|
|
|
@@ -23,11 +23,14 @@ Hope you’ll enjoy using it!
|
|
|
23
23
|
|
|
24
24
|
- [Dart Sass Upgrade](#dart-sass-upgrade)
|
|
25
25
|
- [Installation](#installation)
|
|
26
|
-
- [
|
|
27
|
-
- [Using with
|
|
26
|
+
- [Using with Vite](#using-with-vite)
|
|
27
|
+
- [Using with webpack](#using-with-webpack)
|
|
28
|
+
- [Using with Next.js](#using-with-nextjs)
|
|
29
|
+
- [Using with Angular](#using-with-angular)
|
|
28
30
|
- [Using with Gulp](#using-with-gulp)
|
|
29
31
|
- [Using with Grunt](#using-with-grunt)
|
|
30
32
|
- [Cloning the Repository from Github](#cloning-the-repository-from-github)
|
|
33
|
+
- [Versions these examples were tested with](#versions-these-examples-were-tested-with)
|
|
31
34
|
- [Namespace Usage](#namespace-usage)
|
|
32
35
|
- [Vendor Prefix Support](#vendor-prefix-support)
|
|
33
36
|
- [Experimenting](#experimenting)
|
|
@@ -45,74 +48,118 @@ Because LibSass and the packages built on it, including Node Sass, are deprecate
|
|
|
45
48
|
|
|
46
49
|
npm install gerillass --save-dev
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
Or with Yarn:
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
yarn add gerillass --dev
|
|
51
54
|
|
|
52
|
-
**
|
|
55
|
+
Then load it. If your setup resolves packages from **node_modules** — Vite, webpack, Next.js and most modern bundlers do — this is all you need:
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
@use 'gerillass' as *;
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
If you call Dart Sass yourself rather than through a bundler, turn on its package importer and use a `pkg:` URL:
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
@use 'pkg:gerillass' as *;
|
|
59
62
|
|
|
60
|
-
|
|
63
|
+
```js
|
|
64
|
+
// Dart Sass 1.71.0 or later
|
|
65
|
+
import * as sass from 'sass';
|
|
66
|
+
import { NodePackageImporter } from 'sass';
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
sass.compile('style.scss', { importers: [new NodePackageImporter()] });
|
|
69
|
+
```
|
|
63
70
|
|
|
64
|
-
|
|
71
|
+
Or from the command line:
|
|
72
|
+
|
|
73
|
+
sass --pkg-importer=node style.scss style.css
|
|
74
|
+
|
|
75
|
+
Pointing straight at the file always works too:
|
|
76
|
+
|
|
77
|
+
@use '{node_modules_path}/gerillass/scss/gerillass' as *;
|
|
78
|
+
|
|
79
|
+
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.
|
|
80
|
+
|
|
81
|
+
> **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.
|
|
82
|
+
|
|
83
|
+
### Using with Vite
|
|
84
|
+
|
|
85
|
+
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.
|
|
86
|
+
|
|
87
|
+
@use 'gerillass' as *;
|
|
88
|
+
|
|
89
|
+
### Using with webpack
|
|
90
|
+
|
|
91
|
+
`sass-loader` also resolves the package by name, with no extra options.
|
|
92
|
+
|
|
93
|
+
@use 'gerillass' as *;
|
|
94
|
+
|
|
95
|
+
### Using with Next.js
|
|
96
|
+
|
|
97
|
+
Next.js needs to be told where the library lives. In `next.config.mjs`:
|
|
98
|
+
|
|
99
|
+
export default {
|
|
100
|
+
sassOptions: {
|
|
101
|
+
loadPaths: ["node_modules/gerillass/scss"],
|
|
102
|
+
},
|
|
103
|
+
};
|
|
65
104
|
|
|
66
|
-
|
|
105
|
+
Then, in any `.scss` file:
|
|
67
106
|
|
|
68
|
-
|
|
107
|
+
@use 'gerillass' as *;
|
|
69
108
|
|
|
70
|
-
### Using with
|
|
109
|
+
### Using with Angular
|
|
71
110
|
|
|
72
|
-
|
|
111
|
+
Add the library folder to the build target's options in `angular.json`. Angular calls this option `includePaths`, not `loadPaths`:
|
|
73
112
|
|
|
74
|
-
|
|
113
|
+
"stylePreprocessorOptions": {
|
|
114
|
+
"includePaths": ["node_modules/gerillass/scss"]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
Then, in `src/styles.scss`:
|
|
118
|
+
|
|
119
|
+
@use 'gerillass' as *;
|
|
75
120
|
|
|
76
121
|
### Using with Gulp
|
|
77
122
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.pipe(dest("assets/css"))
|
|
88
|
-
);
|
|
89
|
-
done()
|
|
123
|
+
`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.
|
|
124
|
+
|
|
125
|
+
const { src, dest } = require("gulp");
|
|
126
|
+
const sass = require("gulp-sass")(require("sass"));
|
|
127
|
+
|
|
128
|
+
function styles() {
|
|
129
|
+
return src("assets/sass/**/*.scss")
|
|
130
|
+
.pipe(sass({ loadPaths: ["node_modules/gerillass/scss"] }).on("error", sass.logError))
|
|
131
|
+
.pipe(dest("assets/css"));
|
|
90
132
|
}
|
|
91
133
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
@import 'gerillass';
|
|
134
|
+
exports.styles = styles;
|
|
95
135
|
|
|
96
|
-
|
|
136
|
+
Then:
|
|
97
137
|
|
|
98
|
-
|
|
138
|
+
@use 'gerillass' as *;
|
|
99
139
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
140
|
+
### Using with Grunt
|
|
141
|
+
|
|
142
|
+
Use `grunt-sass` with Dart Sass as the implementation. The option here is **`loadPaths`** as well — not `loadPath`, and not `includePaths`.
|
|
143
|
+
|
|
144
|
+
module.exports = function (grunt) {
|
|
145
|
+
grunt.loadNpmTasks("grunt-sass");
|
|
146
|
+
grunt.initConfig({
|
|
147
|
+
sass: {
|
|
148
|
+
dist: {
|
|
149
|
+
options: {
|
|
150
|
+
implementation: require("sass"),
|
|
151
|
+
loadPaths: ["node_modules/gerillass/scss"],
|
|
152
|
+
},
|
|
153
|
+
files: { "css/main.css": "src/main.scss" },
|
|
154
|
+
},
|
|
105
155
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
Then:
|
|
160
|
+
|
|
161
|
+
@use 'gerillass' as *;
|
|
111
162
|
|
|
112
|
-
Including to the project:
|
|
113
|
-
|
|
114
|
-
@import 'gerillass';
|
|
115
|
-
|
|
116
163
|
### Cloning the repository from Github
|
|
117
164
|
|
|
118
165
|
You can clone the repository into your local computer from Github.
|
|
@@ -125,7 +172,19 @@ Or you can add the library as a submodule into your Git based project ([What is
|
|
|
125
172
|
|
|
126
173
|
Including to the project:
|
|
127
174
|
|
|
128
|
-
@
|
|
175
|
+
@use '{folder_path}/gerillass/scss/gerillass' as *;
|
|
176
|
+
|
|
177
|
+
### Versions these examples were tested with
|
|
178
|
+
|
|
179
|
+
| Tool | Version |
|
|
180
|
+
|---|---|
|
|
181
|
+
| Dart Sass | 1.103.1 |
|
|
182
|
+
| Vite | 8.2.2 |
|
|
183
|
+
| webpack / sass-loader | 5.110.3 / 17.0.1 |
|
|
184
|
+
| Next.js | 16.3.4 |
|
|
185
|
+
| Angular CLI | 20.3.36 |
|
|
186
|
+
| Gulp / gulp-sass | 5.0.1 / 6.0.1 |
|
|
187
|
+
| Grunt / grunt-sass | 1.6.3 / 4.1.0 |
|
|
129
188
|
|
|
130
189
|
## Namespace Usage
|
|
131
190
|
|
|
@@ -161,4 +220,4 @@ Gerillass is licensed under the Apache License, Version 2.0. For more [see the l
|
|
|
161
220
|
|
|
162
221
|
## Additional Info
|
|
163
222
|
|
|
164
|
-
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
|
|
223
|
+
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).
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
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: 51 mixins and 21 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
|
+
Dart Sass only. LibSass and node-sass are not supported.
|
|
37
|
+
|
|
38
|
+
## Two names for every mixin
|
|
39
|
+
|
|
40
|
+
Every mixin exists twice: bare (`ratio-box`) and prefixed (`gls-ratio-box`).
|
|
41
|
+
They are the same mixin. The prefix exists to avoid collisions with other
|
|
42
|
+
libraries. Pick one and stay with it; do not mix them in a file.
|
|
43
|
+
|
|
44
|
+
With the module system you can namespace instead, which is usually cleaner:
|
|
45
|
+
|
|
46
|
+
```scss
|
|
47
|
+
@use "gerillass" as gls;
|
|
48
|
+
.hero { @include gls.ratio-box("16/9"); }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Getting arguments right
|
|
52
|
+
|
|
53
|
+
The conventions are not uniform across the library, so check before guessing.
|
|
54
|
+
The single most common mistake is passing a ratio as a list:
|
|
55
|
+
|
|
56
|
+
```scss
|
|
57
|
+
.hero { @include ratio-box(16 9); } // wrong — errors
|
|
58
|
+
.hero { @include ratio-box("16/9"); } // right
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Mixins that reject bad input do so with a message naming what they accept. If
|
|
62
|
+
you get one, read it: it lists the valid values. Mixins not in the table below
|
|
63
|
+
mostly pass their arguments through to CSS, so a wrong value there shows up as
|
|
64
|
+
a dropped declaration rather than an error.
|
|
65
|
+
|
|
66
|
+
| Mixin | Rejects, for example |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `all-buttons` | `@include all-buttons(nonsense) { color: red; }` |
|
|
69
|
+
| `all-text-inputs` | `@include all-text-inputs(nonsense) { color: red; }` |
|
|
70
|
+
| `antialias` | `@include antialias(only);` |
|
|
71
|
+
| `background-dots` | `.a { @include background-dots(red, 1em, 5em, maybe); }` |
|
|
72
|
+
| `background-image` | `.a { @include background-image("/img/a.png", (red, blue), sideways); }` |
|
|
73
|
+
| `border-box` | `@include border-box(only);` |
|
|
74
|
+
| `border-radius` | `.a { @include border-radius(1px, 2px, 3px); }` |
|
|
75
|
+
| `center` | `.modal { @include center(diagonal); }` |
|
|
76
|
+
| `columnizer` | `.grid { @include columnizer(3, 20px, true, 9); }` |
|
|
77
|
+
| `except` | `.a { @include except(#ff0000) { margin: 0; } }` |
|
|
78
|
+
| `font-face` | `.a { @include font-face("Inter", "/fonts/inter"); }` |
|
|
79
|
+
| `hide` | `.a { @include hide(nonsense); }` |
|
|
80
|
+
| `loadify` | `@include loadify(nonsense);` |
|
|
81
|
+
| `only` | `.a { @include only(#ff0000) { margin: 0; } }` |
|
|
82
|
+
| `ratio-box` | `.hero { @include ratio-box(16 9); }` |
|
|
83
|
+
| `remove` | `.a { @include remove(a, b, c); }` |
|
|
84
|
+
| `reset-css` | `.a { @include reset-css; }` |
|
|
85
|
+
| `responsive-video` | `.video { @include responsive-video(16 9); }` |
|
|
86
|
+
| `scissors` | `.a { @include scissors(5px 10px); }` |
|
|
87
|
+
| `smartphone` | `.a { @include smartphone(Nokia3310) { display: none; } }` |
|
|
88
|
+
| `sprite` | `.icon { @include sprite("/img/sprite.txt"); }` |
|
|
89
|
+
| `stretched-link` | `.card a { @include stretched-link(middle); }` |
|
|
90
|
+
| `tablet` | `.a { @include tablet(Surface) { display: none; } }` |
|
|
91
|
+
| `text-selection` | `.a { @include text-selection(bogus) { background: yellow; } }` |
|
|
92
|
+
| `triangle` | `.caret { @include triangle(sideways); }` |
|
|
93
|
+
|
|
94
|
+
## Mixins
|
|
95
|
+
|
|
96
|
+
| Signature | What it does |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `adaptive($gutter: 30px)` | Centred container whose max-width steps up at every breakpoint. |
|
|
99
|
+
| `after($content: null)` | Styles the ::after pseudo-element. A `data-` argument becomes an attr() content value. |
|
|
100
|
+
| `all-buttons($pseudo: null)` | Targets every button-like element at once, optionally in one pseudo-class state. |
|
|
101
|
+
| `all-text-inputs($pseudo: null)` | Targets every text-like input at once, optionally in one pseudo-class state. |
|
|
102
|
+
| `antialias($value: null)` | Turns on subpixel-antialiased text smoothing. |
|
|
103
|
+
| `background-dots($color: null, $size: 1em, $gutter: $size * 5, $diagonal: true, $image: null)` | Repeating dot pattern as a background, optionally over an image. |
|
|
104
|
+
| `background-image($image-url: null, $filter-color: null, $filter-direction: null)` | Background image with an optional colour or gradient filter laid over it. |
|
|
105
|
+
| `background-stripes($color: null, $thickness: 1em, $rotation: -45deg, $image: null)` | Repeating stripe pattern as a background, optionally over an image. |
|
|
106
|
+
| `before($content: null)` | Styles the ::before pseudo-element. A `data-` argument becomes an attr() content value. |
|
|
107
|
+
| `border-box($value: null)` | Applies box-sizing: border-box. |
|
|
108
|
+
| `border-radius($args...)` | Rounds corners, either all of them, one named corner, or all four individually. |
|
|
109
|
+
| `brand-logo($width, $height, $image-url: null)` | Logo box with an image and an accessible stretched link over it. |
|
|
110
|
+
| `breakpoint($params...)` | Media query built from the breakpoint map, or from raw lengths. |
|
|
111
|
+
| `breakpointer($selector: null)` | Debug helper that prints the active breakpoint name into a pseudo-element. |
|
|
112
|
+
| `center($axis: "both")` | Absolutely centres an element inside its positioned parent. |
|
|
113
|
+
| `circle($size)` | Square element with a fully rounded border, i.e. a circle. |
|
|
114
|
+
| `clearfix` | Clears floated children using an ::after pseudo-element. |
|
|
115
|
+
| `columnizer($params...)` | Flexbox grid of equal columns, with an optional gutter and fill behaviour. |
|
|
116
|
+
| `counter($params...)` | CSS counter for a list, with optional text before and after the number. |
|
|
117
|
+
| `ellipsis($width: 100%, $display: inline-block)` | Truncates a single line of text with an ellipsis. |
|
|
118
|
+
| `escape-to-parent($selector: null)` | Re-roots the current selector under another one using @at-root. |
|
|
119
|
+
| `except($params...)` | Selects every sibling except the ones named. |
|
|
120
|
+
| `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. |
|
|
121
|
+
| `hide($toggle: "hide")` | Visually hides an element while keeping it available to screen readers, or reverses that. |
|
|
122
|
+
| `linear-gradient($direction, $colors)` | Linear gradient background from a direction name or an angle. |
|
|
123
|
+
| `loadify($params...)` | Fades elements in on page load. Call once at the root to set up, then on each element. |
|
|
124
|
+
| `only($params...)` | Selects only the siblings named. |
|
|
125
|
+
| `placeholder-shown` | Styles an input while its placeholder is visible. |
|
|
126
|
+
| `placeholder` | Styles the placeholder text of an input across vendor prefixes. |
|
|
127
|
+
| `position($position: absolute, $offsets: 0)` | Sets position and offsets in one call, using shorthand order. |
|
|
128
|
+
| `radial-gradient($shape, $position, $colors)` | Radial gradient background from a shape and a position. |
|
|
129
|
+
| `ratio-box($ratio: null)` | Container that holds a fixed aspect ratio. Its single direct child is stretched to fill it. |
|
|
130
|
+
| `remove($params...)` | Hides an element outright, or only within a breakpoint range. |
|
|
131
|
+
| `reset-css` | Meyer reset. Must be called at the root of the stylesheet. |
|
|
132
|
+
| `reset-figure` | Removes default figure margins and makes the image inside responsive. |
|
|
133
|
+
| `resizable($direction: both, $overflow: auto)` | Makes an element user-resizable. |
|
|
134
|
+
| `responsive-image` | Makes an image fill its container width. |
|
|
135
|
+
| `responsive-video($ratio: null)` | Wrapper that keeps an embedded video at a fixed aspect ratio. |
|
|
136
|
+
| `scissors($corners)` | Cuts the corners off an element with clip-path. |
|
|
137
|
+
| `screen-agent($resolution)` | Media query targeting a screen pixel density. |
|
|
138
|
+
| `sizer($width, $height: $width)` | Sets width and height together; one argument makes a square. |
|
|
139
|
+
| `smartphone($device, $orientation: null)` | Media query targeting a known smartphone by device dimensions. |
|
|
140
|
+
| `sprite($params...)` | Sets up an element as a sprite tile: an image, a background position, or both. |
|
|
141
|
+
| `stretched-link($value: "before")` | Expands a link to cover its positioned parent, so the whole card is clickable. |
|
|
142
|
+
| `tablet($device, $orientation: null)` | Media query targeting a known tablet by device dimensions. |
|
|
143
|
+
| `text-gradient($direction, $colors)` | Applies a linear gradient to the text itself via background-clip. |
|
|
144
|
+
| `text-image($image: null)` | Fills the text with an image via background-clip. |
|
|
145
|
+
| `text-selection($value: null)` | Styles the ::selection pseudo-element. |
|
|
146
|
+
| `text-shadow($params...)` | Layered text shadows built from a direction, a colour and an offset. |
|
|
147
|
+
| `text-stroke($fallback-color: black, $color: transparent, $stroke-color: black, $stroke-width: 1px)` | Outlines text using the webkit text-stroke properties. |
|
|
148
|
+
| `triangle($direction: "bottom", $color: black, $size: 10px 8px)` | Draws a CSS triangle out of borders, pointing in a given direction. |
|
|
149
|
+
|
|
150
|
+
## Functions
|
|
151
|
+
|
|
152
|
+
Called like normal Sass functions. The two leading underscores mark them as
|
|
153
|
+
functions rather than mixins; they are public API.
|
|
154
|
+
|
|
155
|
+
| Signature | What it does |
|
|
156
|
+
|---|---|
|
|
157
|
+
| `__clearUnit($value)` | Strips the unit off a number, returning it unitless. |
|
|
158
|
+
| `__clearWhitespace($string)` | Removes every space from a string. |
|
|
159
|
+
| `__convertToEm($value)` | Converts a pixel length to em, against a 16px base. |
|
|
160
|
+
| `__convertToNumber($value)` | Parses a string of digits into a number. |
|
|
161
|
+
| `__darken($color, $percentage)` | Mixes a colour towards black by a percentage. |
|
|
162
|
+
| `__fontSizer($size, $time)` | Multiplies a size by a factor. Handy for a modular scale. |
|
|
163
|
+
| `__fontSource($font-family, $file-path, $file-formats)` | Builds one src entry for an @font-face rule. |
|
|
164
|
+
| `__isColor($value)` | Returns the value if every item in it is a colour, and errors otherwise. |
|
|
165
|
+
| `__isNumber($value)` | Returns the value if it is a number. |
|
|
166
|
+
| `__isTime($value)` | Returns the value if it is a time in s or ms, and errors otherwise. |
|
|
167
|
+
| `__lighten($color, $percentage)` | Mixes a colour towards white by a percentage. |
|
|
168
|
+
| `__mapDeepGet($map, $keys...)` | Reads a value out of a nested map by following a chain of keys. |
|
|
169
|
+
| `__null($value, $seperation: comma, $skip: false)` | Replaces null entries in a list with 0, or drops them. |
|
|
170
|
+
| `__pixelify($value)` | Returns the value with a px unit, adding one if it is missing. |
|
|
171
|
+
| `__pseudoSelector($elements, $pseudo: null)` | Appends a pseudo-class to every selector in a list. |
|
|
172
|
+
| `__remify($value)` | Converts a pixel length to rem, against a 16px root. |
|
|
173
|
+
| `__shorthandProperty($value)` | Expands one to four values into the four-value CSS shorthand order. |
|
|
174
|
+
| `__validateBreakpoint($value)` | Resolves a breakpoint name to its width, passing other values through. |
|
|
175
|
+
| `__validateLength($value)` | Returns the value if it is a length or one of auto, inherit, initial, 0. |
|
|
176
|
+
| `__validateRatio($ratio)` | Turns an aspect ratio into the padding-top percentage that holds it. |
|
|
177
|
+
| `__validateScissors($value)` | Normalises corner values for the scissors mixin, adding px where missing. |
|
|
178
|
+
|
|
179
|
+
## Checking your work
|
|
180
|
+
|
|
181
|
+
Sass evaluates mixin bodies lazily, so a stylesheet that merely loads the
|
|
182
|
+
library always compiles. Compile the file that actually calls the mixin:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
sass --load-path=node_modules/gerillass/scss your.scss
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
An empty rule in the output means the mixin matched none of its branches —
|
|
189
|
+
treat that as a bug, not as success.
|