You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
Copy file name to clipboardexpand all lines: README.md
+60
Original file line number
Diff line number
Diff line change
@@ -92,6 +92,66 @@ The callback function is passed a results object, containing the following keys:
92
92
#### importer (starting from v2)
93
93
`importer` is a `Function` to be called when libsass parser encounters the import directive. If present, libsass will call node-sass and let the user change file, data or both during the compilation. This option is optional, and applies to both render and renderSync functions. Also, it can either return object of form `{file:'..', contents: '..'}` or send it back via `done({})`. Note in renderSync or render, there is no restriction imposed on using `done()` callback or `return` statement (dispite of the asnchrony difference).
94
94
95
+
#### functions
96
+
`functions` is an `Object` that holds a collection of custom functions that may be invoked by the sass files being compiled. They may take zero or more input parameters and must return a value either synchronously (`return ...;`) or asynchronously (`done();`). Those parameters will be instances of one of the constructors contained in the `require('node-sass').types` hash. The return value must be of one of these types as well. See the list of available types below:
97
+
98
+
##### types.Number(value [, unit = ""])
99
+
*`getValue()`/ `setValue(value)` : gets / sets the numerical portion of the number
100
+
*`getUnit()` / `setUnit(unit)` : gets / sets the unit portion of the number
101
+
102
+
##### types.String(value)
103
+
*`getValue()` / `setValue(value)` : gets / sets the enclosed string
104
+
105
+
##### types.Color(r, g, b [, a = 1.0]) or types.Color(argb)
106
+
*`getR()` / `setR(value)` : red component (integer from `0` to `255`)
107
+
*`getG()` / `setG(value)` : green component (integer from `0` to `255`)
108
+
*`getB()` / `setB(value)` : blue component (integer from `0` to `255`)
109
+
*`getA()` / `setA(value)` : alpha component (number from `0` to `1.0`)
110
+
111
+
Example:
112
+
113
+
```javascript
114
+
var Color =require('node-sass').types.Color,
115
+
c1 =newColor(255, 0, 0),
116
+
c2 =newColor(0xff0088cc);
117
+
```
118
+
119
+
##### types.Boolean(value)
120
+
*`getValue()` / `setValue(value)` : gets / sets the enclosed boolean
`includePaths` is an `Array` of path `String`s to look for any `@import`ed files. It is recommended that you use this option if you are using the `data` option and have **any**`@import` directives, as otherwise [libsass] may not find your depended-on files.
0 commit comments