reworkcss / rework-plugin-colors

colors() plugin for rework, formerly included in core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add error checking

necolas opened this issue · comments

Moved from reworkcss/rework#116

Issue

When passing an invalid color object to rework.color it bombs out in a not very helpful way. A commonplace error can arise from passing an unevaluated variable.
Since no checks are in place it results in an error stating no property 'r' of undefined which does not aid in debugging.
https://github.com/visionmedia/rework/blob/master/lib/plugins/colors.js#L28

Steps to reproduce

rgba(var-foo);

Expected results

A more useful error is returned.
no r property was found on the color var-foo.
Extra bacon for a stack as to where the value was passed from.