meta-sass-module

Sass module provides more advanced meta functions.


Keywords
sass, module, meta, sass-module
License
MIT
Install
npm install meta-sass-module@1.0.0

Documentation

Meta Sass Module

Logo

  

Sass module provides more advanced meta functions

Install

Install the package:

npm i meta-sass-module

Use the package like any other Sass module:

@use "meta-sass-module"

Depending on your setup, you may need to configure node_modules as include path:

const sass = require("sass");

sass.render({
  file: scss_filename,
  includePaths: ["node_modules"],
});

API

Mixins

# Name Description
1 Apply
meta-sass-module.apply($mixin, $args...)
Mixins can also be values! You can’t directly write a mixin as a value, but you can pass a mixin’s name to the meta-sass-module.get-mixin() function to get it as a value. Once you have a mixin value, you can pass it to the meta-sass-module.apply() mixin to call it. This is for libraries to be extensible in complex and powerful ways.
2 Load CSS
meta-sass-module.load-css($url, $with: null)
Loads the module at $url and includes its CSS as though it were written as the contents of this mixin.

Functions

# Name Description
1 Accepts Content
meta-sass-module.accepts-content($mixin)
Returns whether the given mixin value can accept a @content block.
2 Calculation Arguments
meta-sass-module.calc-args($calc)
Returns the arguments for the given calculation.
3 Calculation Name
meta-sass-module.calc-name($calc)
Returns the name for the given calculation.
4 Call
meta-sass-module.call($function, $args...)
Invokes $function with $args and returns the result.
5 Content Exists
meta-sass-module.content-exists()
Returns whether the current mixin was passed a block.
6 Feature Exists
meta-sass-module.feature-exists($feature)
Returns whether the current Sass implementation supports $feature.
7 Function Exists
meta-sass-module.function-exists($name, $module: null)
Returns whether a function named $name is defined, either as a built-in function or a user-defined function.
8 Get Function
meta-sass-module.get-function($name, $css: false, $module: null)
Returns the function value named $name.
9 Get Mixin
meta-sass-module.get-mixin($name, $module: null)
Returns the mixin value named $name.
10 Global Variable Exists
meta-sass-module.global-variable-exists($name, $module: null)
Returns whether a global variable named $name (without the $) exists.
11 Inspect
meta-sass-module.inspect($value)s
Returns a string representation of $value.
12 Keywords
meta-sass-module.keywords($args)
Returns the keywords passed to a mixin or function that takes arbitrary arguments. The $args argument must be an argument list.
13 Mixin Exists
meta-sass-module.mixin-exists($name, $module: null)
Returns whether a mixin named $name exists.
14 Module Functions
meta-sass-module.module-functions($module)
Returns all the functions defined in a module, as a map from function names to function values.
15 Module Mixins
meta-sass-module.module-mixins($module)
Returns all the mixins defined in a module, as a map from mixin names to mixin values.
16 Module Variables
meta-sass-module.module-variables($module)
Returns all the variables defined in a module, as a map from variable names (without $) to the values of those variables.
17 Type of
meta-sass-module.type-of($value)
Returns the type of $value. This can return the following values: number, string, color, list, map, calculation, bool, null, function, arglist
18 Variable Exists
meta-sass-module.variable-exists($name)
Returns whether a variable named $name (without the $) exists in the current scope.