JSPM

@lunelson/sass-throw

2.0.0-rc.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32
  • Score
    100M100P100Q86324F
  • License MIT

Testable Sass error/warn/debug directives via proxy functions and mixins

Package Exports

  • @lunelson/sass-throw

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lunelson/sass-throw) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

sass-throw

npm published v Build Status

Make @error, @warn and @debug directives testable in Sass.

Use error(), warn() and debug() functions (or mixins) instead of the built-in @error, @warn and @debug directives, and when the global variable $throw-catch is set to true, their messages will be output in CSS rather than passed to Sass directives.

# in your project
npm install --save @lunelson/sass-throw
// in your sass file, assuming you have 'node_modules' in Sass' search path
@import '@lunelson/sass-throw/index';
/* input: test.scss */
$throw-catch: true;

.test {
  error: error('this is an error message via function');
  warn: warn('this is a warn message via function');
  debug: debug('this is a debug message via function');
}

@include error('this is an error message via mixin');
@include warn('this is a warn message via mixin');
@include debug('this is a debug message via mixin');
/* output: test.css */
.test {
  error: "this is an error message via function";
  warn: "this is a warn message via function";
  debug: "this is a debug message via function";
}

.sass-throw .error {
  message: "this is an error message via mixin";
}

.sass-throw .warn {
  message: "this is a warn message via mixin";
}

.sass-throw .debug {
  message: "this is a debug message via mixin";
}

Questions? File an issue, or tweet at me.