eyeglass-timer

Time your sass. Find the slow parts.

Usage no npm install needed!

<script type="module">
  import eyeglassTimer from 'https://cdn.skypack.dev/eyeglass-timer';
</script>

README

Eyeglass Timer

Allows you to time your Sass code to the nearest millisecond.

To use it in your eyeglass project:

$ npm install --save eyeglass-timer

Then in your Sass file(s):

@import "timer";

$timer: timer-start();

// Do something complicated

/*! Complicated thing took: #{elapsed-time($timer)} */

API

  • current-time-ms() - returns the current time in milliseconds since the epoch.
  • timer-start() - returns the time the timer was started.
  • elapsed-time($start-time) - returns the delta since the timer was started.
  • $timer-imported-at - The time the timer module was first imported.

Caveats

This only times the execution of your Sass file. The Sass parse and CSS generation time, as well as the timing of some Sass directives like @extend will happen outside of the execution phase.