Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<p align="center">
<a href="https://github.com/janis-me/surimi" target="_blank" rel="noopener noreferrer">
<img width="180" src="https://surimi.dev/surimi-512x512.webp" alt="Surimi logo">
<a href="https://github.com/janis-me/scss-validate" target="_blank" rel="noopener noreferrer">
<h1 align="center">scss-validate</h1>
</a>
</p>
<p align="center" style="margin-top: -8px">
<a href="https://surimi.dev">
<a href="https://scss-validate.janis.me">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-online-orange">
</a>
<a href="https://npmjs.com/package/surimi">
<img alt="surimi on npm" src="https://img.shields.io/npm/v/surimi?label=surimi%20on%20npm%20&labelColor=grey&color=orange">
<a href="https://npmjs.com/package/scss-validate">
<img alt="scss-validate on npm" src="https://img.shields.io/npm/v/scss-validate?label=scss-validate%20on%20npm%20&labelColor=grey&color=orange">
</a>
<a href="https://github.com/janis-me/surimi">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/janis-me/surimi?style=flat">
<a href="https://github.com/janis-me/scss-validate">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/janis-me/scss-validate?style=flat">
</a>
</p>

# `surimi` - Safe SASS validation library
# `scss-validate` - Safe SASS validation library

Make your SCSS/SASS safer with `surimi`. Define a schema for your data and ensure users use it correctly!
Make your SCSS/SASS safer with `scss-validate`. Define a schema for your data and ensure users use it correctly!

- 🔒 Bulletproof error-checking makes sure you (or your users) don't miss a thing!
- 🚀 No runtime! It's all just SCSS. You'll see the error before it's too late
Expand All @@ -26,30 +26,30 @@ Make your SCSS/SASS safer with `surimi`. Define a schema for your data and ensur
- ✅ Tested with [Vitest](https://vitest.dev) and the sass compiler

> [!NOTE]
> Documentation and reference are now available on our website, [surimi.dev](https://surimi.dev).
> For a quick intro into surimi, check out [surimi.dev/intro](https://surimi.dev/intro)
> Documentation and reference are now available on our website, [scss-validate.dev](https://scss-validate.dev).
> For a quick intro into scss-validate, check out [scss-validate.dev/intro](https://scss-validate.dev/intro)

## installation

Surimi is available as an npm package
scss-validate is available as an npm package

```bash
# npm
npm install surimi
npm install scss-validate
# pnpm
pnpm add surimi
pnpm add scss-validate
```

or via a CDN like unpkg. To load it from a CDN, just `@use` it in your Sass file:

```scss
@use 'https://unpkg.com/surimi@latest' as s;
@use 'https://unpkg.com/scss-validate@latest' as s;
```

## introduction

```scss
@use 'surimi' as s;
@use 'scss-validate' as s;

$my-number-schema: s.number(
$gte: 18,
Expand All @@ -68,13 +68,13 @@ $my-string-schema: s.string(
You will recognize many of the properties - they are simple strings similar to 'zod' or 'yup'. And if you do put a wrong one.. We got you covered!

```
[surimi] `string.min` is not a valid validator. Allowed validators are: [eq, in, not-in, contains, not-contains, ... max-length, min-length]
[scss-validate] `string.min` is not a valid validator. Allowed validators are: [eq, in, not-in, contains, not-contains, ... max-length, min-length]
```

All `surimi` methods are validated themselves - leaving zero room for errors. Of course, validation errors look just as nice:
All `scss-validate` methods are validated themselves - leaving zero room for errors. Of course, validation errors look just as nice:

```
[surimi] Value must be greater than or equal to 18
[scss-validate] Value must be greater than or equal to 18
```

For a full introduction, visit our [docs](https://surimi.dev/intro), or check out the [reference](https://surimi.dev/reference)
For a full introduction, visit our [docs](https://scss-validate.dev/intro), or check out the [reference](https://scss-validate.dev/reference)
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@janis.me/sass",
"description": "surimi - Safe SASS validation library",
"description": "scss-validate - Safe SASS validation library",
"keywords": [
"janis.me",
"sass",
Expand All @@ -10,7 +10,7 @@
"homepage": "https://janis.me",
"repository": {
"type": "git",
"url": "git+https://github.com/janis-me/surimi.git"
"url": "git+https://github.com/janis-me/scss-validate.git"
},
"license": "MIT",
"author": "Janis Jansen",
Expand All @@ -34,7 +34,7 @@
"typescript": "catalog:build",
"vitest": "catalog:test"
},
"packageManager": "pnpm@10.11.0",
"packageManager": "pnpm@10.17.1",
"engines": {
"node": ">=22.11.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import remarkToc from 'remark-toc';

// https://astro.build/config
export default defineConfig({
site: 'https://surimi.dev',
site: 'https://scss-validate.dev',
integrations: [
mdx({
rehypePlugins: [
Expand Down
Binary file removed packages/docs/public/surimi-1024x1024.webp
Binary file not shown.
Binary file removed packages/docs/public/surimi-128x128.webp
Binary file not shown.
Binary file removed packages/docs/public/surimi-256x256.webp
Binary file not shown.
Binary file removed packages/docs/public/surimi-512x512.webp
Binary file not shown.
Binary file removed packages/docs/public/surimi.png
Binary file not shown.
14 changes: 3 additions & 11 deletions packages/docs/src/layouts/Layout.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
---
import { Image } from 'astro:assets';

import logo from '../assets/surimi-256x256.webp';
---

<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/png" href="/surimi-128x128.webp" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<script>
Expand Down Expand Up @@ -51,8 +44,7 @@ import logo from '../assets/surimi-256x256.webp';
<header class="header">
<a href="/">
<h1>
<Image src={logo} alt="Surimi Logo" width={32} height={32} class="logo" />
surimi
scss-validate
</h1>
</a>

Expand All @@ -65,7 +57,7 @@ import logo from '../assets/surimi-256x256.webp';

<div class="header__buttons">
<a
href="https://github.com/janis-me/surimi"
href="https://github.com/janis-me/scss-validate"
target="_blank"
rel="noopener noreferrer"
aria-label="Open Github repository"
Expand All @@ -84,7 +76,7 @@ import logo from '../assets/surimi-256x256.webp';

<footer class="footer">
<p>
©2025 surimi.dev - built with astro, markdown and
©2025 scss-validate.dev - built with astro, markdown and
<a href="https://github.com/janis-me/themed">@janis.me/themed</a>
</p>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: ../layouts/Layout.astro
title: surimi.dev
title: scss-validate.dev
---

import Readme from "../../README.md";
Expand Down
38 changes: 19 additions & 19 deletions packages/docs/src/pages/intro.mdx
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
---
layout: ../layouts/Layout.astro
title: surimi.dev - intro
title: scss-validate.dev - intro
---
<html>
<head>
<title>surimi.dev - intro</title>
<title>scss-validate.dev - intro</title>
</head>
</html>

# An introduction to surimi
# An introduction to scss-validate

It's **very** easy to get started. TL;DR:
1. Install: `npm install surimi`,
2. Import: `@use 'surimi' as s;`,
1. Install: `npm install scss-validate`,
2. Import: `@use 'scss-validate' as s;`,
3. Define a schema: `s.number($min: 0)`,
4. Use it: `s.validate($my-schema, 20)`.

## Content

## Installation

Surimi is available as an npm package
scss-validate is available as an npm package

```bash
# npm
npm install surimi
npm install scss-validate
# pnpm
pnpm add surimi
pnpm add scss-validate
```

or via a CDN like unpkg. To load it from a CDN, just `@use` it in your Sass file:

```scss
@use "https://unpkg.com/surimi@latest" as s;
@use "https://unpkg.com/scss-validate@latest" as s;
```

## Usage

First, import `surimi`, optionally with the `s` namespace.
First, import `scss-validate`, optionally with the `s` namespace.
```scss {1}
@use "surimi" as s;
@use "scss-validate" as s;

$schema: s.number(
$min: 0,
Expand All @@ -51,7 +51,7 @@ $schema: s.number(
Then, define a schema. For example, a number between 0 and 100:

```scss {3-6}
@use "surimi" as s;
@use "scss-validate" as s;

$schema: s.number(
$min: 0,
Expand All @@ -64,7 +64,7 @@ $schema: s.number(
And finally, call the `validate mixin to check the schema.

```scss {8}
@use "surimi" as s;
@use "scss-validate" as s;

$schema: s.number(
$min: 0,
Expand All @@ -77,10 +77,10 @@ $schema: s.number(
By default, the validate mixin will throw an error as soon as the value does not meet the schema. In this case, the error will be:

```bash
"[surimi] Value must be less than or equal to `100`"
"[scss-validate] Value must be less than or equal to `100`"
```

You might note that it shows `[surimi]` and `Value` in the error message. Both can be customized to your liking! Just pass the `$label` and `$prefix` arguments to the `validate` mixin to get
You might note that it shows `[scss-validate]` and `Value` in the error message. Both can be customized to your liking! Just pass the `$label` and `$prefix` arguments to the `validate` mixin to get
```bash
"[my-lib] My number must be less than or equal to `100`"
```
Expand Down Expand Up @@ -129,7 +129,7 @@ A lot going on here! But basically it's just a map with a few props, and a list
@include s.validate(
$theme-schema,
(
'name': 'surimi',
'name': 'scss-validate',
'kind': 'light',
'tokens': (
(
Expand All @@ -148,12 +148,12 @@ A lot going on here! But basically it's just a map with a few props, and a list
Now, if a value inside that map does not meet the schema, the error will be more descriptive:

```bash
"[surimi] Token value must be greater than or equal to `0`"
"[scss-validate] Token value must be greater than or equal to `0`"
```

Maps and lists are even able to infer the label by using the propery key! So if you were to leave out labels for these properties, it would still make sense:
```bash
"[surimi] User.tokens > items.value must be greater than or equal to `0`"
"[scss-validate] User.tokens > items.value must be greater than or equal to `0`"
```

## Validators
Expand All @@ -163,7 +163,7 @@ Each schema ([number](/reference#number), [string](/reference#string), [map](/re
Usually, these validators are very descriptive, like `min`, `min-length`, `unique` etc.
If you want to see all available validators, check the [reference](/reference), or pass some gibberish to the schema! It will show you exactly what validators are available for that schema.
```bash
"[surimi] `string.awdawd` is not a valid validator. Allowed validators are: [eq ne contains not-contains starts-with ends-with ... in not-in min max]"
"[scss-validate] `string.awdawd` is not a valid validator. Allowed validators are: [eq ne contains not-contains starts-with ends-with ... in not-in min max]"
```

Every validator accepts a `$label` property, which will be used in the error message (see above).
Expand Down
12 changes: 6 additions & 6 deletions packages/docs/src/pages/reference.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
layout: ../layouts/Layout.astro
title: surimi.dev - reference
title: scss-validate.dev - reference
---
<html>
<head>
<title>surimi.dev - reference</title>
<title>scss-validate.dev - reference</title>
</head>
</html>

# surimi reference
This page is a reference for the Surimi library, which provides a set of mixins and functions for validating Sass variables against defined schemas.
# scss-validate reference
This page is a reference for the scss-validate library, which provides a set of mixins and functions for validating Sass variables against defined schemas.

### Content:
- [Validation](#validation)
Expand All @@ -26,7 +26,7 @@ This page is a reference for the Surimi library, which provides a set of mixins

### `validate` ||validate||
<div style="padding-left: 16px; border-left: 2px solid var(--themed-gray-3);">
Signature: `s.validate($schema, $value, $label: null, $throw: true, $prefix: 'surimi')`
Signature: `s.validate($schema, $value, $label: null, $throw: true, $prefix: 'scss-validate')`

Validate a given value against a schema.

Expand All @@ -44,7 +44,7 @@ $schema: s.list(s.number($min: 0, $max: 100), $unique: true);

### `validate-fn` ||validate-fn||
<div style="padding-left: 16px; border-left: 2px solid var(--themed-gray-3);">
Signature: `validate-fn($schema, $value, $label: null, $throw: true, $warn: false, $prefix: 'surimi')`
Signature: `validate-fn($schema, $value, $label: null, $throw: true, $warn: false, $prefix: 'scss-validate')`

Validate a given value against a schema.

Expand Down
2 changes: 1 addition & 1 deletion packages/example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/themed-logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>`surimi` example!</title>
<title>`scss-validate` example!</title>
</head>
<body>
<div id="app">
Expand Down
4 changes: 2 additions & 2 deletions packages/example/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@janis.me/surimi-example",
"name": "@janis.me/scss-validate-example",
"version": "0.0.0",
"private": true,
"type": "module",
Expand All @@ -10,7 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"surimi": "workspace:*"
"scss-validate": "workspace:*"
},
"devDependencies": {
"@janis.me/linter-config": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions packages/example/src/styles/main.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use 'surimi' as s;
@use 'scss-validate' as s;

$theme-schema: s.map(
(
Expand Down Expand Up @@ -33,7 +33,7 @@ $theme-schema: s.map(
@include s.validate(
$theme-schema,
(
'name': 'surimi',
'name': 'scss-validate',
'kind': 'light',
'tokens': (
('name': 'primary', 'value': 100),
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "surimi",
"name": "scss-validate",
"version": "0.2.2",
"private": false,
"description": "surimi - Safe SASS validation library",
"description": "scss-validate - Safe SASS validation library",
"keywords": [
"janis.me",
"sass",
Expand All @@ -12,7 +12,7 @@
"homepage": "https://janis.me",
"repository": {
"type": "git",
"url": "git+https://github.com/janis-me/surimi.git"
"url": "git+https://github.com/janis-me/scss-validate.git"
},
"license": "MIT",
"type": "module",
Expand Down
Loading