Commit 920225a9 by Adeel

Code: Interface changes for latest libsass.

parent 53b11171
language: node_js language: node_js
compiler:
- gcc
node_js: node_js:
- "0.10" - "0.10"
- "0.11" - "0.11"
before_install: before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test;
- sudo apt-get update;
- sudo apt-get install gcc-4.8 g++-4.8;
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20;
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20;
- sudo g++ --version;
- sudo apt-get update -qq;
- git submodule update --init --recursive - git submodule update --init --recursive
after_success: after_success:
- npm run-script coverage - npm run-script coverage
......
...@@ -31,7 +31,7 @@ char* CreateString(Local<Value> value) { ...@@ -31,7 +31,7 @@ char* CreateString(Local<Value> value) {
} }
void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper* ctx_w, bool isFile) { void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper* ctx_w, bool isFile) {
int source_comments; bool source_comments;
Local<Object> options = optionsValue->ToObject(); Local<Object> options = optionsValue->ToObject();
if (ctx_w) { if (ctx_w) {
...@@ -56,12 +56,10 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper* ...@@ -56,12 +56,10 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper*
ctx->output_path = CreateString(options->Get(NanNew("outFile"))); ctx->output_path = CreateString(options->Get(NanNew("outFile")));
ctx->options.image_path = CreateString(options->Get(NanNew("imagePath"))); ctx->options.image_path = CreateString(options->Get(NanNew("imagePath")));
ctx->options.output_style = options->Get(NanNew("style"))->Int32Value(); ctx->options.output_style = options->Get(NanNew("style"))->Int32Value();
ctx->options.source_comments = source_comments = options->Get(NanNew("comments"))->Int32Value(); ctx->options.source_comments = source_comments = options->Get(NanNew("comments"))->BooleanValue();
ctx->omit_source_map_url = options->Get(NanNew("omitSourceMapUrl"))->BooleanValue(); ctx->options.omit_source_map_url = options->Get(NanNew("omitSourceMapUrl"))->BooleanValue();
ctx->options.source_map_file = CreateString(options->Get(NanNew("sourceMap")));
ctx->options.include_paths = CreateString(options->Get(NanNew("paths"))); ctx->options.include_paths = CreateString(options->Get(NanNew("paths")));
if (source_comments == SASS_SOURCE_COMMENTS_MAP) {
ctx->source_map_file = CreateString(options->Get(NanNew("sourceMap")));
}
ctx->options.precision = options->Get(NanNew("precision"))->Int32Value(); ctx->options.precision = options->Get(NanNew("precision"))->Int32Value();
} else { } else {
sass_context* ctx = (sass_context*) cptr; sass_context* ctx = (sass_context*) cptr;
...@@ -69,8 +67,9 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper* ...@@ -69,8 +67,9 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper*
ctx->output_path = CreateString(options->Get(NanNew("outFile"))); ctx->output_path = CreateString(options->Get(NanNew("outFile")));
ctx->options.image_path = CreateString(options->Get(NanNew("imagePath"))); ctx->options.image_path = CreateString(options->Get(NanNew("imagePath")));
ctx->options.output_style = options->Get(NanNew("style"))->Int32Value(); ctx->options.output_style = options->Get(NanNew("style"))->Int32Value();
ctx->options.source_comments = source_comments = options->Get(NanNew("comments"))->Int32Value(); ctx->options.source_comments = source_comments = options->Get(NanNew("comments"))->BooleanValue();
ctx->omit_source_map_url = options->Get(NanNew("omitSourceMapUrl"))->BooleanValue(); ctx->options.omit_source_map_url = options->Get(NanNew("omitSourceMapUrl"))->BooleanValue();
ctx->options.source_map_file = CreateString(options->Get(NanNew("sourceMap")));
ctx->options.include_paths = CreateString(options->Get(NanNew("paths"))); ctx->options.include_paths = CreateString(options->Get(NanNew("paths")));
ctx->options.precision = options->Get(NanNew("precision"))->Int32Value(); ctx->options.precision = options->Get(NanNew("precision"))->Int32Value();
} }
...@@ -96,7 +95,7 @@ void FillStatsObj(Handle<Object> stats, sass_file_context* ctx) { ...@@ -96,7 +95,7 @@ void FillStatsObj(Handle<Object> stats, sass_file_context* ctx) {
if (ctx->error_status) { if (ctx->error_status) {
return; return;
} }
if (ctx->options.source_comments == SASS_SOURCE_COMMENTS_MAP) { if (ctx->source_map_string) {
source_map = NanNew<String>(ctx->source_map_string); source_map = NanNew<String>(ctx->source_map_string);
} else { } else {
source_map = NanNull(); source_map = NanNull();
......
...@@ -19,19 +19,22 @@ ...@@ -19,19 +19,22 @@
'libsass/file.cpp', 'libsass/file.cpp',
'libsass/functions.cpp', 'libsass/functions.cpp',
'libsass/inspect.cpp', 'libsass/inspect.cpp',
'libsass/node.cpp',
'libsass/output_compressed.cpp', 'libsass/output_compressed.cpp',
'libsass/output_nested.cpp', 'libsass/output_nested.cpp',
'libsass/parser.cpp', 'libsass/parser.cpp',
'libsass/prelexer.cpp', 'libsass/prelexer.cpp',
'libsass/remove_placeholders.cpp',
'libsass/sass.cpp', 'libsass/sass.cpp',
'libsass/sass2scss.cpp',
'libsass/sass_interface.cpp', 'libsass/sass_interface.cpp',
'libsass/sass_util.cpp',
'libsass/source_map.cpp', 'libsass/source_map.cpp',
'libsass/to_c.cpp', 'libsass/to_c.cpp',
'libsass/to_string.cpp', 'libsass/to_string.cpp',
'libsass/units.cpp', 'libsass/units.cpp',
'libsass/utf8_string.cpp', 'libsass/utf8_string.cpp',
'libsass/util.cpp', 'libsass/util.cpp'
'libsass/sass2scss/sass2scss.cpp'
], ],
'include_dirs': [ 'include_dirs': [
'<!(node -e "require(\'nan\')")' '<!(node -e "require(\'nan\')")'
...@@ -42,6 +45,8 @@ ...@@ -42,6 +45,8 @@
'conditions': [ 'conditions': [
['OS=="mac"', { ['OS=="mac"', {
'xcode_settings': { 'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS' : [ '-std=c++11', '-stdlib=libc++' ],
'OTHER_LDFLAGS': [ '-stdlib=libc++' ],
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_CPP_RTTI': 'YES', 'GCC_ENABLE_CPP_RTTI': 'YES',
'MACOSX_DEPLOYMENT_TARGET': '10.7' 'MACOSX_DEPLOYMENT_TARGET': '10.7'
...@@ -62,6 +67,11 @@ ...@@ -62,6 +67,11 @@
# decorated name length exceeded # decorated name length exceeded
4503 4503
] ]
}],
[ 'OS!="win"', {
'cflags+': [ '-std=c++11' ],
'cflags_c+': [ '-std=c++11' ],
'cflags_cc+': [ '-std=c++11' ],
}] }]
] ]
} }
......
...@@ -32,10 +32,10 @@ var SASS_OUTPUT_STYLE = { ...@@ -32,10 +32,10 @@ var SASS_OUTPUT_STYLE = {
}; };
var SASS_SOURCE_COMMENTS = { var SASS_SOURCE_COMMENTS = {
none: 0, none: false,
normal: 1, normal: true,
'default': 1, default: false,
map: 2 map: true
}; };
var prepareOptions = function (options) { var prepareOptions = function (options) {
...@@ -81,7 +81,7 @@ var prepareOptions = function (options) { ...@@ -81,7 +81,7 @@ var prepareOptions = function (options) {
paths: (options.include_paths || options.includePaths || []).join(path.delimiter), paths: (options.include_paths || options.includePaths || []).join(path.delimiter),
imagePath: options.image_path || options.imagePath || '', imagePath: options.image_path || options.imagePath || '',
style: SASS_OUTPUT_STYLE[options.output_style || options.outputStyle] || 0, style: SASS_OUTPUT_STYLE[options.output_style || options.outputStyle] || 0,
comments: SASS_SOURCE_COMMENTS[sourceComments] || 0, comments: SASS_SOURCE_COMMENTS[sourceComments] || false,
omitSourceMapUrl: options.omitSourceMapUrl, omitSourceMapUrl: options.omitSourceMapUrl,
stats: stats, stats: stats,
sourceMap: sourceMap, sourceMap: sourceMap,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment