Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/api-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ process. The compiler has two different modes: direct input as a string with
`Sass_File_Context`. See the code for a list of options available
[Sass_Options](https://github.com/sass/libsass/blob/36feef0/include/sass/interface.h#L18)

The general rule is if the API takes const char* it will make a copy,
but where the API is char* it will take over memory ownership, so make sure to pass
in memory that is allocated via sass_copy_c_string or sass_alloc_memory.

**Building a file compiler**

context = sass_make_file_context("file.scss")
Expand All @@ -73,7 +77,11 @@ process. The compiler has two different modes: direct input as a string with

**Building a data compiler**

context = sass_make_data_context("div { a { color: blue; } }")
// Use sass_copy_c_string or sass_alloc_memory so that libsass can
// be sure to manage the memory correctly!

char* data = sass_copy_c_string("div { a { color: blue; } }");
context = Sass_Data_Context* data_ctx = sass_make_data_context(data);
options = sass_data_context_get_options(context)
sass_option_set_precision(options, 1)
sass_option_set_source_comments(options, true)
Expand Down