Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Sass Basics!
You have completed Sass Basics!
Preview
Besides providing a collection of built-in functions, Sass lets you write your own functions to reuse logic in your code.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
In programming, a function is a piece
of code that returns a result.
0:00
For example, in the last video I
introduced the lighten function
0:01
which creates or
returns a new color value.
0:05
Functions let you write code that
you can quickly use again and again.
0:08
Now Sass functions are similar to mixins,
0:11
because they both extract
repeating patterns from your code.
0:13
And instead of outputting style
decorations or rule sets like mixins do,
0:16
a function outputs a single value.
0:20
For example,
you could write Sass functions
0:22
to handle certain calculations
you repeat in your CSS.
0:25
Like calculating flexible column widths or
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up