sassc 2.0.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.gitmodules +1 -1
  4. data/.travis.yml +9 -3
  5. data/CHANGELOG.md +36 -0
  6. data/CODE_OF_CONDUCT.md +1 -1
  7. data/README.md +1 -1
  8. data/Rakefile +43 -7
  9. data/ext/depend +4 -0
  10. data/ext/extconf.rb +92 -0
  11. data/ext/libsass/VERSION +1 -0
  12. data/ext/libsass/include/sass/base.h +9 -1
  13. data/ext/libsass/include/sass/context.h +5 -1
  14. data/ext/libsass/src/MurmurHash2.hpp +91 -0
  15. data/ext/libsass/src/ast.cpp +755 -2028
  16. data/ext/libsass/src/ast.hpp +492 -2477
  17. data/ext/libsass/src/{to_c.cpp → ast2c.cpp} +22 -16
  18. data/ext/libsass/src/ast2c.hpp +39 -0
  19. data/ext/libsass/src/ast_def_macros.hpp +70 -10
  20. data/ext/libsass/src/ast_fwd_decl.cpp +5 -3
  21. data/ext/libsass/src/ast_fwd_decl.hpp +107 -296
  22. data/ext/libsass/src/ast_helpers.hpp +292 -0
  23. data/ext/libsass/src/ast_sel_cmp.cpp +396 -0
  24. data/ext/libsass/src/ast_sel_super.cpp +539 -0
  25. data/ext/libsass/src/ast_sel_unify.cpp +275 -0
  26. data/ext/libsass/src/ast_sel_weave.cpp +616 -0
  27. data/ext/libsass/src/ast_selectors.cpp +1043 -0
  28. data/ext/libsass/src/ast_selectors.hpp +522 -0
  29. data/ext/libsass/src/ast_supports.cpp +114 -0
  30. data/ext/libsass/src/ast_supports.hpp +121 -0
  31. data/ext/libsass/src/ast_values.cpp +1154 -0
  32. data/ext/libsass/src/ast_values.hpp +498 -0
  33. data/ext/libsass/src/backtrace.cpp +11 -7
  34. data/ext/libsass/src/backtrace.hpp +5 -5
  35. data/ext/libsass/src/base64vlq.cpp +5 -2
  36. data/ext/libsass/src/base64vlq.hpp +1 -1
  37. data/ext/libsass/src/bind.cpp +35 -34
  38. data/ext/libsass/src/bind.hpp +3 -1
  39. data/ext/libsass/src/c2ast.cpp +64 -0
  40. data/ext/libsass/src/c2ast.hpp +14 -0
  41. data/ext/libsass/src/cencode.c +4 -6
  42. data/ext/libsass/src/check_nesting.cpp +83 -88
  43. data/ext/libsass/src/check_nesting.hpp +39 -34
  44. data/ext/libsass/src/color_maps.cpp +168 -164
  45. data/ext/libsass/src/color_maps.hpp +152 -160
  46. data/ext/libsass/src/constants.cpp +20 -0
  47. data/ext/libsass/src/constants.hpp +19 -0
  48. data/ext/libsass/src/context.cpp +104 -121
  49. data/ext/libsass/src/context.hpp +43 -55
  50. data/ext/libsass/src/cssize.cpp +103 -188
  51. data/ext/libsass/src/cssize.hpp +45 -51
  52. data/ext/libsass/src/dart_helpers.hpp +199 -0
  53. data/ext/libsass/src/debugger.hpp +524 -361
  54. data/ext/libsass/src/emitter.cpp +26 -26
  55. data/ext/libsass/src/emitter.hpp +20 -18
  56. data/ext/libsass/src/environment.cpp +41 -27
  57. data/ext/libsass/src/environment.hpp +33 -22
  58. data/ext/libsass/src/error_handling.cpp +92 -94
  59. data/ext/libsass/src/error_handling.hpp +73 -50
  60. data/ext/libsass/src/eval.cpp +380 -515
  61. data/ext/libsass/src/eval.hpp +64 -57
  62. data/ext/libsass/src/eval_selectors.cpp +75 -0
  63. data/ext/libsass/src/expand.cpp +322 -263
  64. data/ext/libsass/src/expand.hpp +55 -39
  65. data/ext/libsass/src/extender.cpp +1188 -0
  66. data/ext/libsass/src/extender.hpp +399 -0
  67. data/ext/libsass/src/extension.cpp +43 -0
  68. data/ext/libsass/src/extension.hpp +89 -0
  69. data/ext/libsass/src/file.cpp +134 -88
  70. data/ext/libsass/src/file.hpp +28 -37
  71. data/ext/libsass/src/fn_colors.cpp +596 -0
  72. data/ext/libsass/src/fn_colors.hpp +85 -0
  73. data/ext/libsass/src/fn_lists.cpp +285 -0
  74. data/ext/libsass/src/fn_lists.hpp +34 -0
  75. data/ext/libsass/src/fn_maps.cpp +94 -0
  76. data/ext/libsass/src/fn_maps.hpp +30 -0
  77. data/ext/libsass/src/fn_miscs.cpp +244 -0
  78. data/ext/libsass/src/fn_miscs.hpp +40 -0
  79. data/ext/libsass/src/fn_numbers.cpp +227 -0
  80. data/ext/libsass/src/fn_numbers.hpp +45 -0
  81. data/ext/libsass/src/fn_selectors.cpp +205 -0
  82. data/ext/libsass/src/fn_selectors.hpp +35 -0
  83. data/ext/libsass/src/fn_strings.cpp +268 -0
  84. data/ext/libsass/src/fn_strings.hpp +34 -0
  85. data/ext/libsass/src/fn_utils.cpp +158 -0
  86. data/ext/libsass/src/fn_utils.hpp +62 -0
  87. data/ext/libsass/src/inspect.cpp +253 -266
  88. data/ext/libsass/src/inspect.hpp +72 -74
  89. data/ext/libsass/src/json.cpp +2 -2
  90. data/ext/libsass/src/lexer.cpp +25 -84
  91. data/ext/libsass/src/lexer.hpp +5 -16
  92. data/ext/libsass/src/listize.cpp +27 -43
  93. data/ext/libsass/src/listize.hpp +14 -11
  94. data/ext/libsass/src/mapping.hpp +1 -0
  95. data/ext/libsass/src/memory.hpp +12 -0
  96. data/ext/libsass/src/memory/allocator.cpp +48 -0
  97. data/ext/libsass/src/memory/allocator.hpp +138 -0
  98. data/ext/libsass/src/memory/config.hpp +20 -0
  99. data/ext/libsass/src/memory/memory_pool.hpp +186 -0
  100. data/ext/libsass/src/memory/shared_ptr.cpp +33 -0
  101. data/ext/libsass/src/memory/shared_ptr.hpp +332 -0
  102. data/ext/libsass/src/operation.hpp +193 -143
  103. data/ext/libsass/src/operators.cpp +56 -29
  104. data/ext/libsass/src/operators.hpp +11 -11
  105. data/ext/libsass/src/ordered_map.hpp +112 -0
  106. data/ext/libsass/src/output.cpp +59 -75
  107. data/ext/libsass/src/output.hpp +15 -22
  108. data/ext/libsass/src/parser.cpp +662 -818
  109. data/ext/libsass/src/parser.hpp +96 -100
  110. data/ext/libsass/src/parser_selectors.cpp +189 -0
  111. data/ext/libsass/src/permutate.hpp +164 -0
  112. data/ext/libsass/src/plugins.cpp +12 -8
  113. data/ext/libsass/src/plugins.hpp +8 -8
  114. data/ext/libsass/src/position.cpp +10 -26
  115. data/ext/libsass/src/position.hpp +44 -21
  116. data/ext/libsass/src/prelexer.cpp +14 -8
  117. data/ext/libsass/src/prelexer.hpp +9 -9
  118. data/ext/libsass/src/remove_placeholders.cpp +59 -57
  119. data/ext/libsass/src/remove_placeholders.hpp +20 -18
  120. data/ext/libsass/src/sass.cpp +25 -18
  121. data/ext/libsass/src/sass.hpp +22 -14
  122. data/ext/libsass/src/sass2scss.cpp +49 -18
  123. data/ext/libsass/src/sass_context.cpp +104 -132
  124. data/ext/libsass/src/sass_context.hpp +2 -2
  125. data/ext/libsass/src/sass_functions.cpp +7 -4
  126. data/ext/libsass/src/sass_functions.hpp +1 -1
  127. data/ext/libsass/src/sass_values.cpp +26 -21
  128. data/ext/libsass/src/settings.hpp +19 -0
  129. data/ext/libsass/src/source.cpp +69 -0
  130. data/ext/libsass/src/source.hpp +95 -0
  131. data/ext/libsass/src/source_data.hpp +32 -0
  132. data/ext/libsass/src/source_map.cpp +27 -20
  133. data/ext/libsass/src/source_map.hpp +14 -11
  134. data/ext/libsass/src/stylesheet.cpp +22 -0
  135. data/ext/libsass/src/stylesheet.hpp +57 -0
  136. data/ext/libsass/src/to_value.cpp +24 -22
  137. data/ext/libsass/src/to_value.hpp +18 -22
  138. data/ext/libsass/src/units.cpp +28 -22
  139. data/ext/libsass/src/units.hpp +9 -8
  140. data/ext/libsass/src/utf8/checked.h +12 -10
  141. data/ext/libsass/src/utf8/core.h +3 -0
  142. data/ext/libsass/src/utf8_string.cpp +12 -10
  143. data/ext/libsass/src/utf8_string.hpp +7 -6
  144. data/ext/libsass/src/util.cpp +97 -107
  145. data/ext/libsass/src/util.hpp +74 -30
  146. data/ext/libsass/src/util_string.cpp +125 -0
  147. data/ext/libsass/src/util_string.hpp +73 -0
  148. data/ext/libsass/src/values.cpp +33 -24
  149. data/ext/libsass/src/values.hpp +2 -2
  150. data/lib/sassc.rb +24 -0
  151. data/lib/sassc/engine.rb +7 -5
  152. data/lib/sassc/functions_handler.rb +11 -13
  153. data/lib/sassc/native.rb +10 -9
  154. data/lib/sassc/native/native_functions_api.rb +0 -5
  155. data/lib/sassc/script.rb +4 -6
  156. data/lib/sassc/version.rb +1 -1
  157. data/sassc.gemspec +32 -12
  158. data/test/engine_test.rb +32 -2
  159. data/test/functions_test.rb +38 -1
  160. data/test/native_test.rb +4 -4
  161. metadata +95 -109
  162. data/ext/Rakefile +0 -3
  163. data/ext/libsass/.editorconfig +0 -15
  164. data/ext/libsass/.gitattributes +0 -2
  165. data/ext/libsass/.github/CONTRIBUTING.md +0 -65
  166. data/ext/libsass/.github/ISSUE_TEMPLATE.md +0 -54
  167. data/ext/libsass/.gitignore +0 -85
  168. data/ext/libsass/.travis.yml +0 -64
  169. data/ext/libsass/COPYING +0 -25
  170. data/ext/libsass/GNUmakefile.am +0 -88
  171. data/ext/libsass/INSTALL +0 -1
  172. data/ext/libsass/LICENSE +0 -25
  173. data/ext/libsass/Makefile +0 -351
  174. data/ext/libsass/Makefile.conf +0 -55
  175. data/ext/libsass/Readme.md +0 -104
  176. data/ext/libsass/SECURITY.md +0 -10
  177. data/ext/libsass/appveyor.yml +0 -91
  178. data/ext/libsass/configure.ac +0 -138
  179. data/ext/libsass/contrib/libsass.spec +0 -66
  180. data/ext/libsass/docs/README.md +0 -20
  181. data/ext/libsass/docs/api-context-example.md +0 -45
  182. data/ext/libsass/docs/api-context-internal.md +0 -163
  183. data/ext/libsass/docs/api-context.md +0 -295
  184. data/ext/libsass/docs/api-doc.md +0 -215
  185. data/ext/libsass/docs/api-function-example.md +0 -67
  186. data/ext/libsass/docs/api-function-internal.md +0 -8
  187. data/ext/libsass/docs/api-function.md +0 -74
  188. data/ext/libsass/docs/api-importer-example.md +0 -112
  189. data/ext/libsass/docs/api-importer-internal.md +0 -20
  190. data/ext/libsass/docs/api-importer.md +0 -86
  191. data/ext/libsass/docs/api-value-example.md +0 -55
  192. data/ext/libsass/docs/api-value-internal.md +0 -76
  193. data/ext/libsass/docs/api-value.md +0 -154
  194. data/ext/libsass/docs/build-on-darwin.md +0 -27
  195. data/ext/libsass/docs/build-on-gentoo.md +0 -55
  196. data/ext/libsass/docs/build-on-windows.md +0 -139
  197. data/ext/libsass/docs/build-shared-library.md +0 -35
  198. data/ext/libsass/docs/build-with-autotools.md +0 -78
  199. data/ext/libsass/docs/build-with-makefiles.md +0 -68
  200. data/ext/libsass/docs/build-with-mingw.md +0 -107
  201. data/ext/libsass/docs/build-with-visual-studio.md +0 -90
  202. data/ext/libsass/docs/build.md +0 -97
  203. data/ext/libsass/docs/compatibility-plan.md +0 -48
  204. data/ext/libsass/docs/contributing.md +0 -17
  205. data/ext/libsass/docs/custom-functions-internal.md +0 -122
  206. data/ext/libsass/docs/dev-ast-memory.md +0 -223
  207. data/ext/libsass/docs/implementations.md +0 -56
  208. data/ext/libsass/docs/plugins.md +0 -47
  209. data/ext/libsass/docs/setup-environment.md +0 -68
  210. data/ext/libsass/docs/source-map-internals.md +0 -51
  211. data/ext/libsass/docs/trace.md +0 -26
  212. data/ext/libsass/docs/triage.md +0 -17
  213. data/ext/libsass/docs/unicode.md +0 -39
  214. data/ext/libsass/extconf.rb +0 -6
  215. data/ext/libsass/include/sass/version.h.in +0 -12
  216. data/ext/libsass/m4/.gitkeep +0 -0
  217. data/ext/libsass/m4/m4-ax_cxx_compile_stdcxx_11.m4 +0 -167
  218. data/ext/libsass/res/resource.rc +0 -35
  219. data/ext/libsass/script/bootstrap +0 -13
  220. data/ext/libsass/script/branding +0 -10
  221. data/ext/libsass/script/ci-build-libsass +0 -134
  222. data/ext/libsass/script/ci-build-plugin +0 -62
  223. data/ext/libsass/script/ci-install-compiler +0 -6
  224. data/ext/libsass/script/ci-install-deps +0 -20
  225. data/ext/libsass/script/ci-report-coverage +0 -42
  226. data/ext/libsass/script/spec +0 -5
  227. data/ext/libsass/script/tap-driver +0 -652
  228. data/ext/libsass/script/tap-runner +0 -1
  229. data/ext/libsass/script/test-leaks.pl +0 -103
  230. data/ext/libsass/src/GNUmakefile.am +0 -54
  231. data/ext/libsass/src/extend.cpp +0 -2130
  232. data/ext/libsass/src/extend.hpp +0 -86
  233. data/ext/libsass/src/functions.cpp +0 -2234
  234. data/ext/libsass/src/functions.hpp +0 -198
  235. data/ext/libsass/src/memory/SharedPtr.cpp +0 -114
  236. data/ext/libsass/src/memory/SharedPtr.hpp +0 -206
  237. data/ext/libsass/src/node.cpp +0 -319
  238. data/ext/libsass/src/node.hpp +0 -118
  239. data/ext/libsass/src/paths.hpp +0 -71
  240. data/ext/libsass/src/sass_util.cpp +0 -149
  241. data/ext/libsass/src/sass_util.hpp +0 -256
  242. data/ext/libsass/src/subset_map.cpp +0 -55
  243. data/ext/libsass/src/subset_map.hpp +0 -76
  244. data/ext/libsass/src/support/libsass.pc.in +0 -11
  245. data/ext/libsass/src/to_c.hpp +0 -39
  246. data/ext/libsass/test/test_node.cpp +0 -94
  247. data/ext/libsass/test/test_paths.cpp +0 -28
  248. data/ext/libsass/test/test_selector_difference.cpp +0 -25
  249. data/ext/libsass/test/test_specificity.cpp +0 -25
  250. data/ext/libsass/test/test_subset_map.cpp +0 -472
  251. data/ext/libsass/test/test_superselector.cpp +0 -69
  252. data/ext/libsass/test/test_unification.cpp +0 -31
  253. data/ext/libsass/version.sh +0 -10
  254. data/ext/libsass/win/libsass.sln +0 -39
  255. data/ext/libsass/win/libsass.sln.DotSettings +0 -9
  256. data/ext/libsass/win/libsass.targets +0 -118
  257. data/ext/libsass/win/libsass.vcxproj +0 -188
  258. data/ext/libsass/win/libsass.vcxproj.filters +0 -357
  259. data/lib/sassc/native/lib_c.rb +0 -21
  260. data/lib/tasks/libsass.rb +0 -33
@@ -1,20 +0,0 @@
1
- Welcome to the LibSass documentation!
2
-
3
- ## First Off
4
- LibSass is just a library. To run the code locally (i.e. to compile your stylesheets), you need an implementer. SassC (get it?) is an implementer written in C. There are a number of other implementations of LibSass - for example Node. We encourage you to write your own port - the whole point of LibSass is that we want to bring Sass to many other languages, not just Ruby!
5
-
6
- We're working hard on moving to full parity with Ruby Sass... learn more at the [The-LibSass-Compatibility-Plan](compatibility-plan.md)!
7
-
8
- ### Implementing LibSass
9
-
10
- If you're interested in implementing LibSass in your own project see the [API Documentation](api-doc.md) which now includes implementing
11
- your own [Sass functions](api-function.md). You may wish to [look at other implementations](implementations.md) for your language of choice.
12
- Or make your own!
13
-
14
- ### Contributing to LibSass
15
-
16
- | Issue Tracker | Issue Triage | Community Guidelines |
17
- |-------------------|----------------------------------|-----------------------------|
18
- | We're always needing help, so check out our issue tracker, help some people out, and read our article on [Contributing](contributing.md)! It's got all the details on what to do! | To help understand the process of triaging bugs, have a look at our [Issue-Triage](triage.md) document. | Oh, and don't forget we always follow [[Sass Community Guidelines|http://sass-lang.com/community-guidelines]]. Be nice and everyone else will be nice too! |
19
-
20
- Please refer to the steps on [Building LibSass](build.md)
@@ -1,45 +0,0 @@
1
- ## Example main.c
2
-
3
- ```C
4
- #include <stdio.h>
5
- #include "sass/context.h"
6
-
7
- int main( int argc, const char* argv[] )
8
- {
9
-
10
- // get the input file from first argument or use default
11
- const char* input = argc > 1 ? argv[1] : "styles.scss";
12
-
13
- // create the file context and get all related structs
14
- struct Sass_File_Context* file_ctx = sass_make_file_context(input);
15
- struct Sass_Context* ctx = sass_file_context_get_context(file_ctx);
16
- struct Sass_Options* ctx_opt = sass_context_get_options(ctx);
17
-
18
- // configure some options ...
19
- sass_option_set_precision(ctx_opt, 10);
20
-
21
- // context is set up, call the compile step now
22
- int status = sass_compile_file_context(file_ctx);
23
-
24
- // print the result or the error to the stdout
25
- if (status == 0) puts(sass_context_get_output_string(ctx));
26
- else puts(sass_context_get_error_message(ctx));
27
-
28
- // release allocated memory
29
- sass_delete_file_context(file_ctx);
30
-
31
- // exit status
32
- return status;
33
-
34
- }
35
- ```
36
-
37
- ### Compile main.c
38
-
39
- ```bash
40
- gcc -c main.c -o main.o
41
- gcc -o sample main.o -lsass
42
- echo "foo { margin: 21px * 2; }" > foo.scss
43
- ./sample foo.scss => "foo { margin: 42px }"
44
- ```
45
-
@@ -1,163 +0,0 @@
1
- ```C
2
- // Input behaviours
3
- enum Sass_Input_Style {
4
- SASS_CONTEXT_NULL,
5
- SASS_CONTEXT_FILE,
6
- SASS_CONTEXT_DATA,
7
- SASS_CONTEXT_FOLDER
8
- };
9
-
10
- // sass config options structure
11
- struct Sass_Inspect_Options {
12
-
13
- // Output style for the generated css code
14
- // A value from above SASS_STYLE_* constants
15
- enum Sass_Output_Style output_style;
16
-
17
- // Precision for fractional numbers
18
- int precision;
19
-
20
- };
21
-
22
- // sass config options structure
23
- struct Sass_Output_Options : Sass_Inspect_Options {
24
-
25
- // String to be used for indentation
26
- const char* indent;
27
- // String to be used to for line feeds
28
- const char* linefeed;
29
-
30
- // Emit comments in the generated CSS indicating
31
- // the corresponding source line.
32
- bool source_comments;
33
-
34
- };
35
-
36
- // sass config options structure
37
- struct Sass_Options : Sass_Output_Options {
38
-
39
- // embed sourceMappingUrl as data uri
40
- bool source_map_embed;
41
-
42
- // embed include contents in maps
43
- bool source_map_contents;
44
-
45
- // create file urls for sources
46
- bool source_map_file_urls;
47
-
48
- // Disable sourceMappingUrl in css output
49
- bool omit_source_map_url;
50
-
51
- // Treat source_string as sass (as opposed to scss)
52
- bool is_indented_syntax_src;
53
-
54
- // The input path is used for source map
55
- // generation. It can be used to define
56
- // something with string compilation or to
57
- // overload the input file path. It is
58
- // set to "stdin" for data contexts and
59
- // to the input file on file contexts.
60
- char* input_path;
61
-
62
- // The output path is used for source map
63
- // generation. LibSass will not write to
64
- // this file, it is just used to create
65
- // information in source-maps etc.
66
- char* output_path;
67
-
68
- // Colon-separated list of paths
69
- // Semicolon-separated on Windows
70
- // Maybe use array interface instead?
71
- char* include_path;
72
- char* plugin_path;
73
-
74
- // Include paths (linked string list)
75
- struct string_list* include_paths;
76
- // Plugin paths (linked string list)
77
- struct string_list* plugin_paths;
78
-
79
- // Path to source map file
80
- // Enables source map generation
81
- // Used to create sourceMappingUrl
82
- char* source_map_file;
83
-
84
- // Directly inserted in source maps
85
- char* source_map_root;
86
-
87
- // Custom functions that can be called from sccs code
88
- Sass_Function_List c_functions;
89
-
90
- // Callback to overload imports
91
- Sass_Importer_List c_importers;
92
-
93
- // List of custom headers
94
- Sass_Importer_List c_headers;
95
-
96
- };
97
-
98
- // base for all contexts
99
- struct Sass_Context : Sass_Options
100
- {
101
-
102
- // store context type info
103
- enum Sass_Input_Style type;
104
-
105
- // generated output data
106
- char* output_string;
107
-
108
- // generated source map json
109
- char* source_map_string;
110
-
111
- // error status
112
- int error_status;
113
- char* error_json;
114
- char* error_text;
115
- char* error_message;
116
- // error position
117
- char* error_file;
118
- size_t error_line;
119
- size_t error_column;
120
- const char* error_src;
121
-
122
- // report imported files
123
- char** included_files;
124
-
125
- };
126
-
127
- // struct for file compilation
128
- struct Sass_File_Context : Sass_Context {
129
-
130
- // no additional fields required
131
- // input_path is already on options
132
-
133
- };
134
-
135
- // struct for data compilation
136
- struct Sass_Data_Context : Sass_Context {
137
-
138
- // provided source string
139
- char* source_string;
140
- char* srcmap_string;
141
-
142
- };
143
-
144
- // Compiler states
145
- enum Sass_Compiler_State {
146
- SASS_COMPILER_CREATED,
147
- SASS_COMPILER_PARSED,
148
- SASS_COMPILER_EXECUTED
149
- };
150
-
151
- // link c and cpp context
152
- struct Sass_Compiler {
153
- // progress status
154
- Sass_Compiler_State state;
155
- // original c context
156
- Sass_Context* c_ctx;
157
- // Sass::Context
158
- Sass::Context* cpp_ctx;
159
- // Sass::Block
160
- Sass::Block_Obj root;
161
- };
162
- ```
163
-
@@ -1,295 +0,0 @@
1
- Sass Contexts come in two flavors:
2
-
3
- - `Sass_File_Context`
4
- - `Sass_Data_Context`
5
-
6
- ### Basic Usage
7
-
8
- ```C
9
- #include "sass/context.h"
10
- ```
11
-
12
- ***Sass_Options***
13
-
14
- ```C
15
- // Precision for fractional numbers
16
- int precision;
17
- ```
18
- ```C
19
- // Output style for the generated css code
20
- // A value from above SASS_STYLE_* constants
21
- int output_style;
22
- ```
23
- ```C
24
- // Emit comments in the generated CSS indicating
25
- // the corresponding source line.
26
- bool source_comments;
27
- ```
28
- ```C
29
- // embed sourceMappingUrl as data uri
30
- bool source_map_embed;
31
- ```
32
- ```C
33
- // embed include contents in maps
34
- bool source_map_contents;
35
- ```
36
- ```C
37
- // create file urls for sources
38
- bool source_map_file_urls;
39
- ```
40
- ```C
41
- // Disable sourceMappingUrl in css output
42
- bool omit_source_map_url;
43
- ```
44
- ```C
45
- // Treat source_string as sass (as opposed to scss)
46
- bool is_indented_syntax_src;
47
- ```
48
- ```C
49
- // The input path is used for source map
50
- // generating. It can be used to define
51
- // something with string compilation or to
52
- // overload the input file path. It is
53
- // set to "stdin" for data contexts and
54
- // to the input file on file contexts.
55
- char* input_path;
56
- ```
57
- ```C
58
- // The output path is used for source map
59
- // generating. LibSass will not write to
60
- // this file, it is just used to create
61
- // information in source-maps etc.
62
- char* output_path;
63
- ```
64
- ```C
65
- // String to be used for indentation
66
- const char* indent;
67
- ```
68
- ```C
69
- // String to be used to for line feeds
70
- const char* linefeed;
71
- ```
72
- ```C
73
- // Colon-separated list of paths
74
- // Semicolon-separated on Windows
75
- char* include_path;
76
- char* plugin_path;
77
- ```
78
- ```C
79
- // Additional include paths
80
- // Must be null delimited
81
- char** include_paths;
82
- char** plugin_paths;
83
- ```
84
- ```C
85
- // Path to source map file
86
- // Enables the source map generating
87
- // Used to create sourceMappingUrl
88
- char* source_map_file;
89
- ```
90
- ```C
91
- // Directly inserted in source maps
92
- char* source_map_root;
93
- ```
94
- ```C
95
- // Custom functions that can be called from Sass code
96
- Sass_C_Function_List c_functions;
97
- ```
98
- ```C
99
- // Callback to overload imports
100
- Sass_C_Import_Callback importer;
101
- ```
102
-
103
- ***Sass_Context***
104
-
105
- ```C
106
- // store context type info
107
- enum Sass_Input_Style type;
108
- ````
109
- ```C
110
- // generated output data
111
- char* output_string;
112
- ```
113
- ```C
114
- // generated source map json
115
- char* source_map_string;
116
- ```
117
- ```C
118
- // error status
119
- int error_status;
120
- char* error_json;
121
- char* error_text;
122
- char* error_message;
123
- // error position
124
- char* error_file;
125
- size_t error_line;
126
- size_t error_column;
127
- ```
128
- ```C
129
- // report imported files
130
- char** included_files;
131
- ```
132
-
133
- ***Sass_File_Context***
134
-
135
- ```C
136
- // no additional fields required
137
- // input_path is already on options
138
- ```
139
-
140
- ***Sass_Data_Context***
141
-
142
- ```C
143
- // provided source string
144
- char* source_string;
145
- ```
146
-
147
- ### Sass Context API
148
-
149
- ```C
150
- // Forward declaration
151
- struct Sass_Compiler;
152
-
153
- // Forward declaration
154
- struct Sass_Options;
155
- struct Sass_Context; // : Sass_Options
156
- struct Sass_File_Context; // : Sass_Context
157
- struct Sass_Data_Context; // : Sass_Context
158
-
159
- // Create and initialize an option struct
160
- struct Sass_Options* sass_make_options (void);
161
- // Create and initialize a specific context
162
- struct Sass_File_Context* sass_make_file_context (const char* input_path);
163
- struct Sass_Data_Context* sass_make_data_context (char* source_string);
164
-
165
- // Call the compilation step for the specific context
166
- int sass_compile_file_context (struct Sass_File_Context* ctx);
167
- int sass_compile_data_context (struct Sass_Data_Context* ctx);
168
-
169
- // Create a sass compiler instance for more control
170
- struct Sass_Compiler* sass_make_file_compiler (struct Sass_File_Context* file_ctx);
171
- struct Sass_Compiler* sass_make_data_compiler (struct Sass_Data_Context* data_ctx);
172
-
173
- // Execute the different compilation steps individually
174
- // Usefull if you only want to query the included files
175
- int sass_compiler_parse (struct Sass_Compiler* compiler);
176
- int sass_compiler_execute (struct Sass_Compiler* compiler);
177
-
178
- // Release all memory allocated with the compiler
179
- // This does _not_ include any contexts or options
180
- void sass_delete_compiler (struct Sass_Compiler* compiler);
181
- void sass_delete_options(struct Sass_Options* options);
182
-
183
- // Release all memory allocated and also ourself
184
- void sass_delete_file_context (struct Sass_File_Context* ctx);
185
- void sass_delete_data_context (struct Sass_Data_Context* ctx);
186
-
187
- // Getters for Context from specific implementation
188
- struct Sass_Context* sass_file_context_get_context (struct Sass_File_Context* file_ctx);
189
- struct Sass_Context* sass_data_context_get_context (struct Sass_Data_Context* data_ctx);
190
-
191
- // Getters for Context_Options from Sass_Context
192
- struct Sass_Options* sass_context_get_options (struct Sass_Context* ctx);
193
- struct Sass_Options* sass_file_context_get_options (struct Sass_File_Context* file_ctx);
194
- struct Sass_Options* sass_data_context_get_options (struct Sass_Data_Context* data_ctx);
195
- void sass_file_context_set_options (struct Sass_File_Context* file_ctx, struct Sass_Options* opt);
196
- void sass_data_context_set_options (struct Sass_Data_Context* data_ctx, struct Sass_Options* opt);
197
-
198
- // Getters for Sass_Context values
199
- const char* sass_context_get_output_string (struct Sass_Context* ctx);
200
- int sass_context_get_error_status (struct Sass_Context* ctx);
201
- const char* sass_context_get_error_json (struct Sass_Context* ctx);
202
- const char* sass_context_get_error_text (struct Sass_Context* ctx);
203
- const char* sass_context_get_error_message (struct Sass_Context* ctx);
204
- const char* sass_context_get_error_file (struct Sass_Context* ctx);
205
- size_t sass_context_get_error_line (struct Sass_Context* ctx);
206
- size_t sass_context_get_error_column (struct Sass_Context* ctx);
207
- const char* sass_context_get_source_map_string (struct Sass_Context* ctx);
208
- char** sass_context_get_included_files (struct Sass_Context* ctx);
209
-
210
- // Getters for Sass_Compiler options (query import stack)
211
- size_t sass_compiler_get_import_stack_size(struct Sass_Compiler* compiler);
212
- Sass_Import_Entry sass_compiler_get_last_import(struct Sass_Compiler* compiler);
213
- Sass_Import_Entry sass_compiler_get_import_entry(struct Sass_Compiler* compiler, size_t idx);
214
- // Getters for Sass_Compiler options (query function stack)
215
- size_t sass_compiler_get_callee_stack_size(struct Sass_Compiler* compiler);
216
- Sass_Callee_Entry sass_compiler_get_last_callee(struct Sass_Compiler* compiler);
217
- Sass_Callee_Entry sass_compiler_get_callee_entry(struct Sass_Compiler* compiler, size_t idx);
218
-
219
- // Take ownership of memory (value on context is set to 0)
220
- char* sass_context_take_error_json (struct Sass_Context* ctx);
221
- char* sass_context_take_error_text (struct Sass_Context* ctx);
222
- char* sass_context_take_error_message (struct Sass_Context* ctx);
223
- char* sass_context_take_error_file (struct Sass_Context* ctx);
224
- char* sass_context_take_output_string (struct Sass_Context* ctx);
225
- char* sass_context_take_source_map_string (struct Sass_Context* ctx);
226
- ```
227
-
228
- ### Sass Options API
229
-
230
- ```C
231
- // Getters for Context_Option values
232
- int sass_option_get_precision (struct Sass_Options* options);
233
- enum Sass_Output_Style sass_option_get_output_style (struct Sass_Options* options);
234
- bool sass_option_get_source_comments (struct Sass_Options* options);
235
- bool sass_option_get_source_map_embed (struct Sass_Options* options);
236
- bool sass_option_get_source_map_contents (struct Sass_Options* options);
237
- bool sass_option_get_source_map_file_urls (struct Sass_Options* options);
238
- bool sass_option_get_omit_source_map_url (struct Sass_Options* options);
239
- bool sass_option_get_is_indented_syntax_src (struct Sass_Options* options);
240
- const char* sass_option_get_indent (struct Sass_Options* options);
241
- const char* sass_option_get_linefeed (struct Sass_Options* options);
242
- const char* sass_option_get_input_path (struct Sass_Options* options);
243
- const char* sass_option_get_output_path (struct Sass_Options* options);
244
- const char* sass_option_get_source_map_file (struct Sass_Options* options);
245
- const char* sass_option_get_source_map_root (struct Sass_Options* options);
246
- Sass_C_Function_List sass_option_get_c_functions (struct Sass_Options* options);
247
- Sass_C_Import_Callback sass_option_get_importer (struct Sass_Options* options);
248
-
249
- // Getters for Context_Option include path array
250
- size_t sass_option_get_include_path_size(struct Sass_Options* options);
251
- const char* sass_option_get_include_path(struct Sass_Options* options, size_t i);
252
- // Plugin paths to load dynamic libraries work the same
253
- size_t sass_option_get_plugin_path_size(struct Sass_Options* options);
254
- const char* sass_option_get_plugin_path(struct Sass_Options* options, size_t i);
255
-
256
- // Setters for Context_Option values
257
- void sass_option_set_precision (struct Sass_Options* options, int precision);
258
- void sass_option_set_output_style (struct Sass_Options* options, enum Sass_Output_Style output_style);
259
- void sass_option_set_source_comments (struct Sass_Options* options, bool source_comments);
260
- void sass_option_set_source_map_embed (struct Sass_Options* options, bool source_map_embed);
261
- void sass_option_set_source_map_contents (struct Sass_Options* options, bool source_map_contents);
262
- void sass_option_set_source_map_file_urls (struct Sass_Options* options, bool source_map_file_urls);
263
- void sass_option_set_omit_source_map_url (struct Sass_Options* options, bool omit_source_map_url);
264
- void sass_option_set_is_indented_syntax_src (struct Sass_Options* options, bool is_indented_syntax_src);
265
- void sass_option_set_indent (struct Sass_Options* options, const char* indent);
266
- void sass_option_set_linefeed (struct Sass_Options* options, const char* linefeed);
267
- void sass_option_set_input_path (struct Sass_Options* options, const char* input_path);
268
- void sass_option_set_output_path (struct Sass_Options* options, const char* output_path);
269
- void sass_option_set_plugin_path (struct Sass_Options* options, const char* plugin_path);
270
- void sass_option_set_include_path (struct Sass_Options* options, const char* include_path);
271
- void sass_option_set_source_map_file (struct Sass_Options* options, const char* source_map_file);
272
- void sass_option_set_source_map_root (struct Sass_Options* options, const char* source_map_root);
273
- void sass_option_set_c_functions (struct Sass_Options* options, Sass_C_Function_List c_functions);
274
- void sass_option_set_importer (struct Sass_Options* options, Sass_C_Import_Callback importer);
275
-
276
- // Push function for paths (no manipulation support for now)
277
- void sass_option_push_plugin_path (struct Sass_Options* options, const char* path);
278
- void sass_option_push_include_path (struct Sass_Options* options, const char* path);
279
-
280
- // Resolve a file via the given include paths in the sass option struct
281
- // find_file looks for the exact file name while find_include does a regular sass include
282
- char* sass_find_file (const char* path, struct Sass_Options* opt);
283
- char* sass_find_include (const char* path, struct Sass_Options* opt);
284
-
285
- // Resolve a file relative to last import or include paths in the sass option struct
286
- // find_file looks for the exact file name while find_include does a regular sass include
287
- char* sass_compiler_find_file (const char* path, struct Sass_Compiler* compiler);
288
- char* sass_compiler_find_include (const char* path, struct Sass_Compiler* compiler);
289
- ```
290
-
291
- ### More links
292
-
293
- - [Sass Context Example](api-context-example.md)
294
- - [Sass Context Internal](api-context-internal.md)
295
-