officialxviid/sasses
最新稳定版本:1.0.0
Composer 安装命令:
composer require officialxviid/sasses
包简介
Sass modules (Sasses) provide more advanced variables, mixins and functions for Sass.
README 文档
README
Sass modules (Sasses) provide more advanced variables, mixins and functions for Sass.
Getting Started
Require
- Dart Sass:
>= 1.23.0
Installation
Node Package Manager (NPM)
npm i sasses
Packagist
composer require officialxviid/sasses
How to Use
For example, we use the parameter-type() function in the throw package.
throw.parameter-type($context, $name, $value, $catch: false, $types...); // or parameter-type-exception($context, $name, $value, $catch: false, $types...);
If you use a specific package, then:
@use "sass:meta"; @use "sass:color"; @use "@sasses/throw"; @function tint-color($color, $amount) { @if meta.type-of($color) != "color" { @return throw.parameter-type("tint-color", "color", $color, false, "color"); } @if meta.type-of($amount) != "number" { @return throw.parameter-type( "tint-color", "amount", $amount, false, "number" ); } @return color.mix(#fff, $color, $amount); } // ❌ Try the result with Invalid input @debug tint-color(true, "one"); // ✅ Try the result with Valid input @debug tint-color(#c69, 90%);
Otherwise,
@use "sass:meta"; @use "sass:color"; @function tint-color($color, $amount) { @if meta.type-of($color) != "color" { @return parameter-type-exception( "tint-color", "color", $color, false, "color" ); } @if meta.type-of($amount) != "number" { @return parameter-type-exception( "tint-color", "amount", $amount, false, "number" ); } @return color.mix(#fff, $color, $amount); } // ❌ Try the result with Invalid input @debug tint-color(true, "one"); // ✅ Try the result with Valid input @debug tint-color(#c69, 90%);
Packages
Throw Package
Provides Sass mixins and functions to standardize exception messages.
Mixins
- Exception
- Use in place of
@errorstatements inside mixins or other control structures with CSS output (not functions). - Variable
- Use in place of variable
@errorstatements inside mixins or other control structures with CSS output (not functions). - Variable Type
- Use in place of variable type
@errorstatements inside mixins or other control structures with CSS output (not functions). - Parameter
- Use in place of parameter
@errorstatements inside mixins or other control structures with CSS output (not functions). - Parameter Type
- Use in place of parameter type
@errorstatements inside mixins or other control structures with CSS output (not functions).
Function
- Exception
- Use in place of
@errorstatements inside functions. - Variable
- Returns an error message stating an issue with one or more variables.
- Variable Type
- Returns an error message stating a variable received the wrong type.
- Parameter
- Returns an error message stating an issue with one or more parameters.
- Parameter Type
- Returns an error message stating a parameter received the wrong type.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2025-06-23