sassy
v1.0.0
Published
A small SCSS/SASS library that adds essential functionality and makes working with maps easier.
Downloads
12
Maintainers
Readme
Sassy
Sassy eases the pain for object-oriented programmers and makes getting around in SASS a little easier.
###Overview
Sassy provides some essential functionality and makes working with maps much easier.
It also includes a debugging utility for unit-testing (see notes at the bottom).
Methods:
- get
- set
- has
- compare
- type
- types
- types-same
- contains
- explode
- implode
- thru
- apply
- increase
- decrease
Method Uses:
@note All methods that use a ( map, key, ... ) signature allow for nested maps using a key list!
Signature:
- get( map, key )
- get( map, ( nested, key ) )
Supported types: map
Signature:
- set( map, key, value )
- set( map, ( nested, key ), value )
@note Remember SASS objects are immutable. Replace your map reference each time!
Supported types: map
Signature: has( map, key, [return], [default] )
Optional default value IF NO KEY (otherwise returns null).
Supported types: map
Signature: compare( A, B )
Supported types: any
Signature: type( var, [against] )
Supported types: any
Signature: types ( varN... )
Supported types: any
Signature: types-same ( varN... )
Supported types: any
Signature: contains( haystack, needle )
Supported types: map, list, string
Signature: explode( string, [delimiter='-'] )
Supported types: string
Signature: implode( list, [wrap=false], [glue=', '] )
@note wrap is optional. if true, adds ( ) to string before returning
Supported types: list
Signature: thru( any )
Supported types: any
Signature: print( map )
Supported types: map
Signature:
- apply( method_name, argslist... )
- apply( method_name, ( list, of, args ) )
- apply( method_name, argsmap )
Supported types: function
Signature:
- increase( number, [x=1] )
- increase( map, key, [x=1] )
Supported types: number, map with number as value to a key
Signature:
- decrease( number, [x=1] )
- decrease( map, key, [x=1] )
Supported types: number, map with number as value to a key
Signature: pluck( key, maps.. )
@note also accepts a list of maps
Supported types: map
Sassy Debugger
I put together a SASS debug utility based loosely on my much more robust JS debugger.
There are only 3 mixins you need (really only "test", but it's better to use all 3).
Signature: @include start(debug_name)
Signature:
- @include test( method_name, arguments, [expect=true] )
- @include test( name, result, [expect=true] )
You should always use a list of arguments instead of a result boolean.
The result boolean option is there for edge cases where comparing the result isn't so easy.
If you need to pass a single list, use an argsmap
( args: ( your, list ) )
You can add a variation string as the 4th parameter. Useful if debugging similar signatures.
Mixin: complete
reports a summary of pass/fail
@note fire this after all of your tests. it will tell you that all tests passed or which ones failed (and why).
--
That's all! Enjoy the software!