Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
739cc088
Commit
739cc088
authored
Nov 17, 2014
by
Adeel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code: Cleanup.
parent
af72ccc4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
binding.cpp
src/binding.cpp
+6
-9
No files found.
src/binding.cpp
View file @
739cc088
...
@@ -12,7 +12,7 @@ char* CreateString(Local<Value> value) {
...
@@ -12,7 +12,7 @@ char* CreateString(Local<Value> value) {
return
str
;
return
str
;
}
}
void
ExtractOptions
(
Local
<
Object
>
options
,
void
*
cptr
,
sass_context_wrapper
*
ctx_w
,
char
*
data_or_path
,
bool
isFile
)
{
void
ExtractOptions
(
Local
<
Object
>
options
,
void
*
cptr
,
sass_context_wrapper
*
ctx_w
,
bool
isFile
)
{
bool
source_comments
;
bool
source_comments
;
if
(
ctx_w
)
{
if
(
ctx_w
)
{
...
@@ -36,7 +36,6 @@ void ExtractOptions(Local<Object> options, void* cptr, sass_context_wrapper* ctx
...
@@ -36,7 +36,6 @@ void ExtractOptions(Local<Object> options, void* cptr, sass_context_wrapper* ctx
struct
Sass_Context
*
ctx
=
sass_file_context_get_context
(
fctx
);
struct
Sass_Context
*
ctx
=
sass_file_context_get_context
(
fctx
);
struct
Sass_Options
*
sass_options
=
sass_context_get_options
(
ctx
);
struct
Sass_Options
*
sass_options
=
sass_context_get_options
(
ctx
);
sass_option_set_input_path
(
sass_options
,
data_or_path
);
sass_option_set_output_path
(
sass_options
,
CreateString
(
options
->
Get
(
NanNew
(
"outFile"
))));
sass_option_set_output_path
(
sass_options
,
CreateString
(
options
->
Get
(
NanNew
(
"outFile"
))));
sass_option_set_image_path
(
sass_options
,
CreateString
(
options
->
Get
(
NanNew
(
"imagePath"
))));
sass_option_set_image_path
(
sass_options
,
CreateString
(
options
->
Get
(
NanNew
(
"imagePath"
))));
sass_option_set_output_style
(
sass_options
,
(
Sass_Output_Style
)
options
->
Get
(
NanNew
(
"style"
))
->
Int32Value
());
sass_option_set_output_style
(
sass_options
,
(
Sass_Output_Style
)
options
->
Get
(
NanNew
(
"style"
))
->
Int32Value
());
...
@@ -64,12 +63,10 @@ void ExtractOptions(Local<Object> options, void* cptr, sass_context_wrapper* ctx
...
@@ -64,12 +63,10 @@ void ExtractOptions(Local<Object> options, void* cptr, sass_context_wrapper* ctx
void
FillStatsObj
(
Handle
<
Object
>
stats
,
Sass_Context
*
ctx
)
{
void
FillStatsObj
(
Handle
<
Object
>
stats
,
Sass_Context
*
ctx
)
{
char
**
included_files
=
sass_context_get_included_files
(
ctx
);
char
**
included_files
=
sass_context_get_included_files
(
ctx
);
//int length = sizeof(included_files) / sizeof(included_files[0]);
//int length = std::char_traits<char*>::length(included_files);
Handle
<
Array
>
arr
=
NanNew
<
Array
>
();
Handle
<
Array
>
arr
=
NanNew
<
Array
>
();
if
(
included_files
)
{
if
(
included_files
)
{
for
(
int
i
=
0
;
included_files
[
i
]
!=
nullptr
;
++
i
)
{
//cout<<included_files[i]<<endl;
for
(
int
i
=
0
;
included_files
[
i
]
!=
nullptr
;
++
i
)
{
arr
->
Set
(
i
,
NanNew
<
String
>
(
included_files
[
i
]));
arr
->
Set
(
i
,
NanNew
<
String
>
(
included_files
[
i
]));
}
}
}
}
...
@@ -147,7 +144,7 @@ NAN_METHOD(Render) {
...
@@ -147,7 +144,7 @@ NAN_METHOD(Render) {
ctx_w
->
dctx
=
dctx
;
ctx_w
->
dctx
=
dctx
;
ExtractOptions
(
options
,
dctx
,
ctx_w
,
source_string
,
false
);
ExtractOptions
(
options
,
dctx
,
ctx_w
,
false
);
int
status
=
uv_queue_work
(
uv_default_loop
(),
&
ctx_w
->
request
,
compile_it
,
(
uv_after_work_cb
)
MakeCallback
);
int
status
=
uv_queue_work
(
uv_default_loop
(),
&
ctx_w
->
request
,
compile_it
,
(
uv_after_work_cb
)
MakeCallback
);
...
@@ -165,7 +162,7 @@ NAN_METHOD(RenderSync) {
...
@@ -165,7 +162,7 @@ NAN_METHOD(RenderSync) {
struct
Sass_Data_Context
*
dctx
=
sass_make_data_context
(
source_string
);
struct
Sass_Data_Context
*
dctx
=
sass_make_data_context
(
source_string
);
struct
Sass_Context
*
ctx
=
sass_data_context_get_context
(
dctx
);
struct
Sass_Context
*
ctx
=
sass_data_context_get_context
(
dctx
);
ExtractOptions
(
options
,
dctx
,
NULL
,
source_string
,
false
);
ExtractOptions
(
options
,
dctx
,
NULL
,
false
);
compile_data
(
dctx
);
compile_data
(
dctx
);
FillStatsObj
(
options
->
Get
(
NanNew
(
"stats"
))
->
ToObject
(),
ctx
);
FillStatsObj
(
options
->
Get
(
NanNew
(
"stats"
))
->
ToObject
(),
ctx
);
// free(source_string);
// free(source_string);
...
@@ -194,7 +191,7 @@ NAN_METHOD(RenderFile) {
...
@@ -194,7 +191,7 @@ NAN_METHOD(RenderFile) {
sass_context_wrapper
*
ctx_w
=
sass_make_context_wrapper
();
sass_context_wrapper
*
ctx_w
=
sass_make_context_wrapper
();
ctx_w
->
fctx
=
fctx
;
ctx_w
->
fctx
=
fctx
;
ExtractOptions
(
options
,
fctx
,
ctx_w
,
input_path
,
true
);
ExtractOptions
(
options
,
fctx
,
ctx_w
,
true
);
int
status
=
uv_queue_work
(
uv_default_loop
(),
&
ctx_w
->
request
,
compile_it
,
(
uv_after_work_cb
)
MakeCallback
);
int
status
=
uv_queue_work
(
uv_default_loop
(),
&
ctx_w
->
request
,
compile_it
,
(
uv_after_work_cb
)
MakeCallback
);
assert
(
status
==
0
);
assert
(
status
==
0
);
...
@@ -212,7 +209,7 @@ NAN_METHOD(RenderFileSync) {
...
@@ -212,7 +209,7 @@ NAN_METHOD(RenderFileSync) {
struct
Sass_File_Context
*
fctx
=
sass_make_file_context
(
input_path
);
struct
Sass_File_Context
*
fctx
=
sass_make_file_context
(
input_path
);
struct
Sass_Context
*
ctx
=
sass_file_context_get_context
(
fctx
);
struct
Sass_Context
*
ctx
=
sass_file_context_get_context
(
fctx
);
ExtractOptions
(
options
,
fctx
,
NULL
,
input_path
,
true
);
ExtractOptions
(
options
,
fctx
,
NULL
,
true
);
compile_file
(
fctx
);
compile_file
(
fctx
);
FillStatsObj
(
options
->
Get
(
NanNew
(
"stats"
))
->
ToObject
(),
ctx
);
FillStatsObj
(
options
->
Get
(
NanNew
(
"stats"
))
->
ToObject
(),
ctx
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment