• SASS Hacks Writeup
    • Code Explanation
Javascript Calculator
0
1
2
3
+
4
5
6
-
7
8
9
*
0
.
sqrt
/
^
%
=
A/C

SASS Hacks Writeup

The _mixins.scss file is a CSS processor, a part of the Syntacticaly Awesome Style Sheets. Mixins are reusable chunks of CSS code that are similar to functions in programming; they define a certain set of styles that can be called upon by other stylesheets or HTML files. The underscore represents that the mixins stylesheet can not be compiled by itself; it will be included in a larger sheet as it is only a partial stylesheet.

Code Explanation

The following code is a CSS class definition. It defines a mixin named button. The @include is used to reference a mixin (button) that is defined elsewhere. The common styles of button will be applied to the .calc-button class. This mixin is referenced in the stylesheets used to code this calculator, as well as in the code for the calculator on this .md page. The button is also reused in the binary calculator, making using the style sheet an effective way to code this element of the site.