定制 officialxviid/sasses 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

NPM Version Composer Version License

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 @error statements inside mixins or other control structures with CSS output (not functions).
Variable
Use in place of variable @error statements inside mixins or other control structures with CSS output (not functions).
Variable Type
Use in place of variable type @error statements inside mixins or other control structures with CSS output (not functions).
Parameter
Use in place of parameter @error statements inside mixins or other control structures with CSS output (not functions).
Parameter Type
Use in place of parameter type @error statements inside mixins or other control structures with CSS output (not functions).

Function

Exception
Use in place of @error statements 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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Sass

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2025-06-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固