sassc 2.0.1 → 2.1.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitmodules +1 -1
- data/.travis.yml +7 -3
- data/CHANGELOG.md +3 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/README.md +1 -1
- data/Rakefile +23 -8
- data/ext/extconf.rb +39 -0
- data/ext/libsass/.gitignore +1 -0
- data/ext/libsass/GNUmakefile.am +23 -39
- data/ext/libsass/Makefile +56 -91
- data/ext/libsass/Makefile.conf +16 -2
- data/ext/libsass/configure.ac +8 -12
- data/ext/libsass/include/sass/base.h +1 -0
- data/ext/libsass/include/sass/context.h +1 -1
- data/ext/libsass/src/GNUmakefile.am +1 -5
- data/ext/libsass/src/ast.cpp +747 -2010
- data/ext/libsass/src/ast.hpp +239 -2383
- data/ext/libsass/src/{to_c.cpp → ast2c.cpp} +22 -16
- data/ext/libsass/src/ast2c.hpp +39 -0
- data/ext/libsass/src/ast_def_macros.hpp +62 -10
- data/ext/libsass/src/ast_fwd_decl.cpp +1 -0
- data/ext/libsass/src/ast_fwd_decl.hpp +43 -165
- data/ext/libsass/src/ast_sel_cmp.cpp +909 -0
- data/ext/libsass/src/ast_sel_unify.cpp +280 -0
- data/ext/libsass/src/ast_selectors.cpp +1475 -0
- data/ext/libsass/src/ast_selectors.hpp +568 -0
- data/ext/libsass/src/ast_supports.cpp +130 -0
- data/ext/libsass/src/ast_supports.hpp +121 -0
- data/ext/libsass/src/ast_values.cpp +967 -0
- data/ext/libsass/src/ast_values.hpp +489 -0
- data/ext/libsass/src/backtrace.cpp +4 -0
- data/ext/libsass/src/base64vlq.cpp +3 -0
- data/ext/libsass/src/bind.cpp +18 -17
- data/ext/libsass/src/bind.hpp +3 -1
- data/ext/libsass/src/c2ast.cpp +64 -0
- data/ext/libsass/src/c2ast.hpp +14 -0
- data/ext/libsass/src/cencode.c +2 -2
- data/ext/libsass/src/check_nesting.cpp +52 -56
- data/ext/libsass/src/check_nesting.hpp +35 -34
- data/ext/libsass/src/color_maps.cpp +156 -153
- data/ext/libsass/src/color_maps.hpp +152 -152
- data/ext/libsass/src/constants.cpp +15 -0
- data/ext/libsass/src/constants.hpp +13 -0
- data/ext/libsass/src/context.cpp +24 -14
- data/ext/libsass/src/context.hpp +6 -6
- data/ext/libsass/src/cssize.cpp +69 -71
- data/ext/libsass/src/cssize.hpp +50 -50
- data/ext/libsass/src/debugger.hpp +117 -110
- data/ext/libsass/src/emitter.cpp +13 -12
- data/ext/libsass/src/emitter.hpp +13 -9
- data/ext/libsass/src/environment.cpp +15 -1
- data/ext/libsass/src/environment.hpp +6 -0
- data/ext/libsass/src/error_handling.cpp +36 -59
- data/ext/libsass/src/error_handling.hpp +29 -16
- data/ext/libsass/src/eval.cpp +302 -323
- data/ext/libsass/src/eval.hpp +64 -55
- data/ext/libsass/src/expand.cpp +94 -88
- data/ext/libsass/src/expand.hpp +33 -37
- data/ext/libsass/src/extend.cpp +38 -36
- data/ext/libsass/src/extend.hpp +15 -15
- data/ext/libsass/src/file.cpp +34 -2
- data/ext/libsass/src/fn_colors.cpp +594 -0
- data/ext/libsass/src/fn_colors.hpp +85 -0
- data/ext/libsass/src/fn_lists.cpp +284 -0
- data/ext/libsass/src/fn_lists.hpp +34 -0
- data/ext/libsass/src/fn_maps.cpp +94 -0
- data/ext/libsass/src/fn_maps.hpp +30 -0
- data/ext/libsass/src/fn_miscs.cpp +256 -0
- data/ext/libsass/src/fn_miscs.hpp +40 -0
- data/ext/libsass/src/fn_numbers.cpp +220 -0
- data/ext/libsass/src/fn_numbers.hpp +45 -0
- data/ext/libsass/src/fn_selectors.cpp +235 -0
- data/ext/libsass/src/fn_selectors.hpp +35 -0
- data/ext/libsass/src/fn_strings.cpp +254 -0
- data/ext/libsass/src/fn_strings.hpp +34 -0
- data/ext/libsass/src/fn_utils.cpp +156 -0
- data/ext/libsass/src/fn_utils.hpp +56 -0
- data/ext/libsass/src/inspect.cpp +101 -152
- data/ext/libsass/src/inspect.hpp +69 -73
- data/ext/libsass/src/json.cpp +2 -2
- data/ext/libsass/src/lexer.cpp +6 -3
- data/ext/libsass/src/listize.cpp +9 -11
- data/ext/libsass/src/listize.hpp +11 -7
- data/ext/libsass/src/memory/SharedPtr.cpp +2 -83
- data/ext/libsass/src/memory/SharedPtr.hpp +127 -143
- data/ext/libsass/src/node.cpp +13 -10
- data/ext/libsass/src/node.hpp +3 -3
- data/ext/libsass/src/operation.hpp +184 -144
- data/ext/libsass/src/operators.cpp +43 -17
- data/ext/libsass/src/operators.hpp +5 -5
- data/ext/libsass/src/output.cpp +21 -18
- data/ext/libsass/src/output.hpp +14 -21
- data/ext/libsass/src/parser.cpp +215 -183
- data/ext/libsass/src/parser.hpp +28 -24
- data/ext/libsass/src/plugins.cpp +5 -1
- data/ext/libsass/src/position.cpp +3 -0
- data/ext/libsass/src/prelexer.cpp +9 -3
- data/ext/libsass/src/prelexer.hpp +9 -9
- data/ext/libsass/src/remove_placeholders.cpp +14 -11
- data/ext/libsass/src/remove_placeholders.hpp +8 -9
- data/ext/libsass/src/sass.cpp +9 -3
- data/ext/libsass/src/sass.hpp +12 -9
- data/ext/libsass/src/sass2scss.cpp +45 -14
- data/ext/libsass/src/sass_context.cpp +18 -15
- data/ext/libsass/src/sass_functions.cpp +6 -3
- data/ext/libsass/src/sass_functions.hpp +1 -1
- data/ext/libsass/src/sass_util.cpp +3 -0
- data/ext/libsass/src/sass_values.cpp +21 -13
- data/ext/libsass/src/source_map.cpp +5 -2
- data/ext/libsass/src/source_map.hpp +2 -2
- data/ext/libsass/src/subset_map.cpp +4 -1
- data/ext/libsass/src/to_value.cpp +23 -21
- data/ext/libsass/src/to_value.hpp +18 -22
- data/ext/libsass/src/units.cpp +4 -0
- data/ext/libsass/src/units.hpp +1 -0
- data/ext/libsass/src/utf8/checked.h +12 -10
- data/ext/libsass/src/utf8/core.h +3 -0
- data/ext/libsass/src/utf8_string.cpp +3 -0
- data/ext/libsass/src/util.cpp +67 -75
- data/ext/libsass/src/util.hpp +64 -19
- data/ext/libsass/src/util_string.cpp +75 -0
- data/ext/libsass/src/util_string.hpp +19 -0
- data/ext/libsass/src/values.cpp +22 -13
- data/ext/libsass/src/values.hpp +2 -2
- data/ext/libsass/win/libsass.targets +30 -4
- data/ext/libsass/win/libsass.vcxproj.filters +82 -4
- data/lib/sassc.rb +24 -0
- data/lib/sassc/engine.rb +2 -2
- data/lib/sassc/native.rb +8 -1
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +19 -11
- data/test/engine_test.rb +26 -1
- data/test/native_test.rb +1 -1
- metadata +66 -72
- data/ext/Rakefile +0 -3
- data/ext/libsass/.github/CONTRIBUTING.md +0 -65
- data/ext/libsass/.github/ISSUE_TEMPLATE.md +0 -54
- data/ext/libsass/.travis.yml +0 -64
- data/ext/libsass/Readme.md +0 -104
- data/ext/libsass/SECURITY.md +0 -10
- data/ext/libsass/appveyor.yml +0 -91
- data/ext/libsass/docs/README.md +0 -20
- data/ext/libsass/docs/api-context-example.md +0 -45
- data/ext/libsass/docs/api-context-internal.md +0 -163
- data/ext/libsass/docs/api-context.md +0 -295
- data/ext/libsass/docs/api-doc.md +0 -215
- data/ext/libsass/docs/api-function-example.md +0 -67
- data/ext/libsass/docs/api-function-internal.md +0 -8
- data/ext/libsass/docs/api-function.md +0 -74
- data/ext/libsass/docs/api-importer-example.md +0 -112
- data/ext/libsass/docs/api-importer-internal.md +0 -20
- data/ext/libsass/docs/api-importer.md +0 -86
- data/ext/libsass/docs/api-value-example.md +0 -55
- data/ext/libsass/docs/api-value-internal.md +0 -76
- data/ext/libsass/docs/api-value.md +0 -154
- data/ext/libsass/docs/build-on-darwin.md +0 -27
- data/ext/libsass/docs/build-on-gentoo.md +0 -55
- data/ext/libsass/docs/build-on-windows.md +0 -139
- data/ext/libsass/docs/build-shared-library.md +0 -35
- data/ext/libsass/docs/build-with-autotools.md +0 -78
- data/ext/libsass/docs/build-with-makefiles.md +0 -68
- data/ext/libsass/docs/build-with-mingw.md +0 -107
- data/ext/libsass/docs/build-with-visual-studio.md +0 -90
- data/ext/libsass/docs/build.md +0 -97
- data/ext/libsass/docs/compatibility-plan.md +0 -48
- data/ext/libsass/docs/contributing.md +0 -17
- data/ext/libsass/docs/custom-functions-internal.md +0 -122
- data/ext/libsass/docs/dev-ast-memory.md +0 -223
- data/ext/libsass/docs/implementations.md +0 -56
- data/ext/libsass/docs/plugins.md +0 -47
- data/ext/libsass/docs/setup-environment.md +0 -68
- data/ext/libsass/docs/source-map-internals.md +0 -51
- data/ext/libsass/docs/trace.md +0 -26
- data/ext/libsass/docs/triage.md +0 -17
- data/ext/libsass/docs/unicode.md +0 -39
- data/ext/libsass/extconf.rb +0 -6
- data/ext/libsass/script/bootstrap +0 -13
- data/ext/libsass/script/branding +0 -10
- data/ext/libsass/script/ci-build-libsass +0 -134
- data/ext/libsass/script/ci-build-plugin +0 -62
- data/ext/libsass/script/ci-install-compiler +0 -6
- data/ext/libsass/script/ci-install-deps +0 -20
- data/ext/libsass/script/ci-report-coverage +0 -42
- data/ext/libsass/script/spec +0 -5
- data/ext/libsass/script/tap-driver +0 -652
- data/ext/libsass/script/tap-runner +0 -1
- data/ext/libsass/script/test-leaks.pl +0 -103
- data/ext/libsass/src/functions.cpp +0 -2234
- data/ext/libsass/src/functions.hpp +0 -198
- data/ext/libsass/src/to_c.hpp +0 -39
- data/ext/libsass/test/test_node.cpp +0 -94
- data/ext/libsass/test/test_paths.cpp +0 -28
- data/ext/libsass/test/test_selector_difference.cpp +0 -25
- data/ext/libsass/test/test_specificity.cpp +0 -25
- data/ext/libsass/test/test_subset_map.cpp +0 -472
- data/ext/libsass/test/test_superselector.cpp +0 -69
- data/ext/libsass/test/test_unification.cpp +0 -31
- data/lib/tasks/libsass.rb +0 -33
@@ -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
|
-
|
data/ext/libsass/docs/api-doc.md
DELETED
@@ -1,215 +0,0 @@
|
|
1
|
-
## Introduction
|
2
|
-
|
3
|
-
LibSass wouldn't be much good without a way to interface with it. These
|
4
|
-
interface documentations describe the various functions and data structures
|
5
|
-
available to implementers. They are split up over three major components, which
|
6
|
-
have all their own source files (plus some common functionality).
|
7
|
-
|
8
|
-
- [Sass Context](api-context.md) - Trigger and handle the main Sass compilation
|
9
|
-
- [Sass Value](api-value.md) - Exchange values and its format with LibSass
|
10
|
-
- [Sass Function](api-function.md) - Get invoked by LibSass for function statments
|
11
|
-
- [Sass Importer](api-importer.md) - Get invoked by LibSass for @import statments
|
12
|
-
|
13
|
-
### Basic usage
|
14
|
-
|
15
|
-
First you will need to include the header file!
|
16
|
-
This will automatically load all other headers too!
|
17
|
-
|
18
|
-
```C
|
19
|
-
#include "sass/context.h"
|
20
|
-
```
|
21
|
-
|
22
|
-
## Basic C Example
|
23
|
-
|
24
|
-
```C
|
25
|
-
#include <stdio.h>
|
26
|
-
#include "sass/context.h"
|
27
|
-
|
28
|
-
int main() {
|
29
|
-
puts(libsass_version());
|
30
|
-
return 0;
|
31
|
-
}
|
32
|
-
```
|
33
|
-
|
34
|
-
```bash
|
35
|
-
gcc -Wall version.c -lsass -o version && ./version
|
36
|
-
```
|
37
|
-
|
38
|
-
## More C Examples
|
39
|
-
|
40
|
-
- [Sample code for Sass Context](api-context-example.md)
|
41
|
-
- [Sample code for Sass Value](api-value-example.md)
|
42
|
-
- [Sample code for Sass Function](api-function-example.md)
|
43
|
-
- [Sample code for Sass Importer](api-importer-example.md)
|
44
|
-
|
45
|
-
## Compiling your code
|
46
|
-
|
47
|
-
The most important is your sass file (or string of sass code). With this, you
|
48
|
-
will want to start a LibSass compiler. Here is some pseudocode describing the
|
49
|
-
process. The compiler has two different modes: direct input as a string with
|
50
|
-
`Sass_Data_Context` or LibSass will do file reading for you by using
|
51
|
-
`Sass_File_Context`. See the code for a list of options available
|
52
|
-
[Sass_Options](https://github.com/sass/libsass/blob/36feef0/include/sass/interface.h#L18)
|
53
|
-
|
54
|
-
**Building a file compiler**
|
55
|
-
|
56
|
-
context = sass_make_file_context("file.scss")
|
57
|
-
options = sass_file_context_get_options(context)
|
58
|
-
sass_option_set_precision(options, 1)
|
59
|
-
sass_option_set_source_comments(options, true)
|
60
|
-
|
61
|
-
sass_file_context_set_options(context, options)
|
62
|
-
|
63
|
-
compiler = sass_make_file_compiler(sass_context)
|
64
|
-
sass_compiler_parse(compiler)
|
65
|
-
sass_compiler_execute(compiler)
|
66
|
-
|
67
|
-
output = sass_context_get_output_string(context)
|
68
|
-
// Retrieve errors during compilation
|
69
|
-
error_status = sass_context_get_error_status(context)
|
70
|
-
json_error = sass_context_get_error_json(context)
|
71
|
-
// Release memory dedicated to the C compiler
|
72
|
-
sass_delete_compiler(compiler)
|
73
|
-
|
74
|
-
**Building a data compiler**
|
75
|
-
|
76
|
-
context = sass_make_data_context("div { a { color: blue; } }")
|
77
|
-
options = sass_data_context_get_options(context)
|
78
|
-
sass_option_set_precision(options, 1)
|
79
|
-
sass_option_set_source_comments(options, true)
|
80
|
-
|
81
|
-
sass_data_context_set_options(context, options)
|
82
|
-
|
83
|
-
compiler = sass_make_data_compiler(context)
|
84
|
-
sass_compiler_parse(compiler)
|
85
|
-
sass_compiler_execute(compiler)
|
86
|
-
|
87
|
-
output = sass_context_get_output_string(context)
|
88
|
-
// div a { color: blue; }
|
89
|
-
// Retrieve errors during compilation
|
90
|
-
error_status = sass_context_get_error_status(context)
|
91
|
-
json_error = sass_context_get_error_json(context)
|
92
|
-
// Release memory dedicated to the C compiler
|
93
|
-
sass_delete_compiler(compiler)
|
94
|
-
|
95
|
-
## Sass Context Internals
|
96
|
-
|
97
|
-
Everything is stored in structs:
|
98
|
-
|
99
|
-
```C
|
100
|
-
struct Sass_Options;
|
101
|
-
struct Sass_Context : Sass_Options;
|
102
|
-
struct Sass_File_context : Sass_Context;
|
103
|
-
struct Sass_Data_context : Sass_Context;
|
104
|
-
```
|
105
|
-
|
106
|
-
This mirrors very well how `libsass` uses these structures.
|
107
|
-
|
108
|
-
- `Sass_Options` holds everything you feed in before the compilation. It also hosts
|
109
|
-
`input_path` and `output_path` options, because they are used to generate/calculate
|
110
|
-
relative links in source-maps. The `input_path` is shared with `Sass_File_Context`.
|
111
|
-
- `Sass_Context` holds all the data returned by the compilation step.
|
112
|
-
- `Sass_File_Context` is a specific implementation that requires no additional fields
|
113
|
-
- `Sass_Data_Context` is a specific implementation that adds the `input_source` field
|
114
|
-
|
115
|
-
Structs can be down-casted to access `context` or `options`!
|
116
|
-
|
117
|
-
## Memory handling and life-cycles
|
118
|
-
|
119
|
-
We keep memory around for as long as the main [context](api-context.md) object
|
120
|
-
is not destroyed (`sass_delete_context`). LibSass will create copies of most
|
121
|
-
inputs/options beside the main sass code. You need to allocate and fill that
|
122
|
-
buffer before passing it to LibSass. You may also overtake memory management
|
123
|
-
from libsass for certain return values (i.e. `sass_context_take_output_string`).
|
124
|
-
|
125
|
-
```C
|
126
|
-
// to allocate buffer to be filled
|
127
|
-
void* sass_alloc_memory(size_t size);
|
128
|
-
// to allocate a buffer from existing string
|
129
|
-
char* sass_copy_c_string(const char* str);
|
130
|
-
// to free overtaken memory when done
|
131
|
-
void sass_free_memory(void* ptr);
|
132
|
-
```
|
133
|
-
|
134
|
-
## Miscellaneous API functions
|
135
|
-
|
136
|
-
```C
|
137
|
-
// Some convenient string helper function
|
138
|
-
char* sass_string_unquote (const char* str);
|
139
|
-
char* sass_string_quote (const char* str, const char quote_mark);
|
140
|
-
|
141
|
-
// Get compiled libsass version
|
142
|
-
const char* libsass_version(void);
|
143
|
-
|
144
|
-
// Implemented sass language version
|
145
|
-
// Hardcoded version 3.4 for time being
|
146
|
-
const char* libsass_language_version(void);
|
147
|
-
```
|
148
|
-
|
149
|
-
## Common Pitfalls
|
150
|
-
|
151
|
-
**input_path**
|
152
|
-
|
153
|
-
The `input_path` is part of `Sass_Options`, but it also is the main option for
|
154
|
-
`Sass_File_Context`. It is also used to generate relative file links in source-
|
155
|
-
maps. Therefore it is pretty usefull to pass this information if you have a
|
156
|
-
`Sass_Data_Context` and know the original path.
|
157
|
-
|
158
|
-
**output_path**
|
159
|
-
|
160
|
-
Be aware that `libsass` does not write the output file itself. This option
|
161
|
-
merely exists to give `libsass` the proper information to generate links in
|
162
|
-
source-maps. The file has to be written to the disk by the
|
163
|
-
binding/implementation. If the `output_path` is omitted, `libsass` tries to
|
164
|
-
extrapolate one from the `input_path` by replacing (or adding) the file ending
|
165
|
-
with `.css`.
|
166
|
-
|
167
|
-
## Error Codes
|
168
|
-
|
169
|
-
The `error_code` is integer value which indicates the type of error that
|
170
|
-
occurred inside the LibSass process. Following is the list of error codes along
|
171
|
-
with the short description:
|
172
|
-
|
173
|
-
* 1: normal errors like parsing or `eval` errors
|
174
|
-
* 2: bad allocation error (memory error)
|
175
|
-
* 3: "untranslated" C++ exception (`throw std::exception`)
|
176
|
-
* 4: legacy string exceptions ( `throw const char*` or `std::string` )
|
177
|
-
* 5: Some other unknown exception
|
178
|
-
|
179
|
-
Although for the API consumer, error codes do not offer much value except
|
180
|
-
indicating whether *any* error occurred during the compilation, it helps
|
181
|
-
debugging the LibSass internal code paths.
|
182
|
-
|
183
|
-
## Real-World Implementations
|
184
|
-
|
185
|
-
The proof is in the pudding, so we have highlighted a few implementations that
|
186
|
-
should be on par with the latest LibSass interface version. Some of them may not
|
187
|
-
have all features implemented!
|
188
|
-
|
189
|
-
1. [Perl Example](https://github.com/sass/perl-libsass/blob/master/lib/CSS/Sass.xs)
|
190
|
-
2. [Go Example](https://godoc.org/github.com/wellington/go-libsass#example-Compiler--Stdin)
|
191
|
-
3. [Node Example](https://github.com/sass/node-sass/blob/master/src/binding.cpp)
|
192
|
-
|
193
|
-
## ABI forward compatibility
|
194
|
-
|
195
|
-
We use a functional API to make dynamic linking more robust and future
|
196
|
-
compatible. The API is not yet 100% stable, so we do not yet guarantee
|
197
|
-
[ABI](https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html) forward
|
198
|
-
compatibility.
|
199
|
-
|
200
|
-
## Plugins (experimental)
|
201
|
-
|
202
|
-
LibSass can load plugins from directories. Just define `plugin_path` on context
|
203
|
-
options to load all plugins from the directories. To implement plugins, please
|
204
|
-
consult the following example implementations.
|
205
|
-
|
206
|
-
- https://github.com/mgreter/libsass-glob
|
207
|
-
- https://github.com/mgreter/libsass-math
|
208
|
-
- https://github.com/mgreter/libsass-digest
|
209
|
-
|
210
|
-
## Internal Structs
|
211
|
-
|
212
|
-
- [Sass Context Internals](api-context-internal.md)
|
213
|
-
- [Sass Value Internals](api-value-internal.md)
|
214
|
-
- [Sass Function Internals](api-function-internal.md)
|
215
|
-
- [Sass Importer Internals](api-importer-internal.md)
|