Sha256: 890a66acf7085f807d96982162414e7b744b10bab63e318345789a2cf3a1363d

Contents?: true

Size: 1.09 KB

Versions: 62

Compression:

Stored size: 1.09 KB

Contents

## Example main.c

```C
#include <stdio.h>
#include "sass/context.h"

int main( int argc, const char* argv[] )
{

  // get the input file from first argument or use default
  const char* input = argc > 1 ? argv[1] : "styles.scss";

  // create the file context and get all related structs
  struct Sass_File_Context* file_ctx = sass_make_file_context(input);
  struct Sass_Context* ctx = sass_file_context_get_context(file_ctx);
  struct Sass_Options* ctx_opt = sass_context_get_options(ctx);

  // configure some options ...
  sass_option_set_precision(ctx_opt, 10);

  // context is set up, call the compile step now
  int status = sass_compile_file_context(file_ctx);

  // print the result or the error to the stdout
  if (status == 0) puts(sass_context_get_output_string(ctx));
  else puts(sass_context_get_error_message(ctx));

  // release allocated memory
  sass_delete_file_context(file_ctx);

  // exit status
  return status;

}
```

### Compile main.c

```bash
gcc -c main.c -o main.o
gcc -o sample main.o -lsass
echo "foo { margin: 21px * 2; }" > foo.scss
./sample foo.scss => "foo { margin: 42px }"
```

Version data entries

62 entries across 60 versions & 17 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/node-sass/src/libsass/docs/api-context-example.md
optimacms-0.1.61 spec/dummy/node_modules/@rails/webpacker/node_modules/node-sass/src/libsass/docs/api-context-example.md
disco_app-0.18.0 test/dummy/node_modules/node-sass/src/libsass/docs/api-context-example.md
disco_app-0.18.2 test/dummy/node_modules/node-sass/src/libsass/docs/api-context-example.md
tang-0.2.1 spec/tang_app/node_modules/node-sass/src/libsass/docs/api-context-example.md
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/node-sass/src/libsass/docs/api-context-example.md
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/node-sass/src/libsass/docs/api-context-example.md
ruby2js-4.0.4 lib/tasks/testrails/node_modules/node-sass/src/libsass/docs/api-context-example.md
ruby2js-4.0.3 lib/tasks/testrails/node_modules/node-sass/src/libsass/docs/api-context-example.md
tang-0.2.0 spec/tang_app/node_modules/node-sass/src/libsass/docs/api-context-example.md
tang-0.1.0 spec/tang_app/node_modules/node-sass/src/libsass/docs/api-context-example.md
tang-0.0.9 spec/tang_app/node_modules/node-sass/src/libsass/docs/api-context-example.md
enju_library-0.3.8 spec/dummy/node_modules/node-sass/src/libsass/docs/api-context-example.md
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/sassc-2.0.0/ext/libsass/docs/api-context-example.md
ilog-0.4.1 node_modules/node-sass/src/libsass/docs/api-context-example.md
ilog-0.4.0 node_modules/node-sass/src/libsass/docs/api-context-example.md
ilog-0.3.3 node_modules/node-sass/src/libsass/docs/api-context-example.md
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/sassc-2.0.1/ext/libsass/docs/api-context-example.md
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/sassc-2.0.1/ext/libsass/docs/api-context-example.md
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/sassc-2.0.1/ext/libsass/docs/api-context-example.md