Sass Prof
Sass Prof is a code profiler for Sass. For each @function
, @mixin
, @include
and $variable
, Sass Prof will show its execution time, which file called it and what arguments were given when it was called. Currently, @extend
is not supported but it is a planned feature.
Requirements
- Sass ~>
3.4.0
Installation
- Install with
gem install sass-prof
- If you're using Compass, add
require "sass-prof"
to yourconfig.rb
- Sass Prof will automatically run next time you compile
- That's it!
Uninstall
- Remove the line
require "sass-prof"
from yourconfig.rb
Usage
You may specify a few options within your config.rb
, such as ignoring certain actions or directing output to a log file.
require "sass-prof"
# Configuration object
prof = SassProf::Config
# Directs all output to a log file
# Default is `false`
prof.output_file = "sass-prof.log"
# Adjust max column width
# Default is `false`
prof.max_width = 40
# Mutes all output to stdout
# Default is `false`
prof.quiet = true
# Maximum execution time allowed in ms
# Default is `100`
prof.t_max = 500
# Alias for `t_max`
prof.max_execution_time = 15
# Enable colored output
# Default is `true`
prof.color = true
# Execution time floating point precision
# Default is `15`
prof.precision = 5
# Ignore certain action types during profile
# Default is `[]`
prof.ignore = [
:fundef,
:fun,
:mixdef,
:mix,
:var,
]
# Alias for `ignore`
prof.ignore_actions = []
Please note: your compile times will be slower due to the overhead of Sass Prof, but I've tried to be as accurate as possible in the measurements. This library was created to help you find potential bottlenecks within your code, so I hope it succeeds in that regard. If you find any bugs or inconsistencies, please file an issue or pull request.
Contributing
- Fork it ( https://github.com/ezekg/sass-prof/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request