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
af72ccc4
Commit
af72ccc4
authored
Nov 17, 2014
by
Adeel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Binding: Refurbishes binding to use new API.
parent
816204c9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
25 deletions
+49
-25
binding.gyp
binding.gyp
+3
-1
binding.cpp
src/binding.cpp
+0
-0
sass_context_wrapper.cpp
src/sass_context_wrapper.cpp
+35
-15
sass_context_wrapper.h
src/sass_context_wrapper.h
+10
-7
api.js
test/api.js
+1
-2
No files found.
binding.gyp
View file @
af72ccc4
...
@@ -29,8 +29,10 @@
...
@@ -29,8 +29,10 @@
'src/libsass/remove_placeholders.cpp',
'src/libsass/remove_placeholders.cpp',
'src/libsass/sass.cpp',
'src/libsass/sass.cpp',
'src/libsass/sass2scss.cpp',
'src/libsass/sass2scss.cpp',
'src/libsass/sass_interface.cpp',
'src/libsass/sass_context.cpp',
'src/libsass/sass_functions.cpp',
'src/libsass/sass_util.cpp',
'src/libsass/sass_util.cpp',
'src/libsass/sass_values.cpp',
'src/libsass/source_map.cpp',
'src/libsass/source_map.cpp',
'src/libsass/to_c.cpp',
'src/libsass/to_c.cpp',
'src/libsass/to_string.cpp',
'src/libsass/to_string.cpp',
...
...
src/binding.cpp
View file @
af72ccc4
This diff is collapsed.
Click to expand it.
src/sass_context_wrapper.cpp
View file @
af72ccc4
#include "sass_context_wrapper.h"
#include "sass_context_wrapper.h"
#include <nan.h>
#include <cstdlib>
extern
"C"
{
extern
"C"
{
using
namespace
std
;
using
namespace
std
;
void
free_context
(
sass_context
*
ctx
)
{
void
compile_it
(
uv_work_t
*
req
)
{
delete
[]
ctx
->
source_string
;
sass_context_wrapper
*
ctx_w
=
static_cast
<
sass_context_wrapper
*>
(
req
->
data
);
delete
[]
ctx
->
options
.
include_paths
;
delete
[]
ctx
->
options
.
image_path
;
if
(
ctx_w
->
dctx
)
{
sass_free_context
(
ctx
);
compile_data
(
ctx_w
->
dctx
);
}
else
if
(
ctx_w
->
fctx
)
{
compile_file
(
ctx_w
->
fctx
);
}
}
void
compile_data
(
struct
Sass_Data_Context
*
dctx
)
{
struct
Sass_Context
*
ctx
=
sass_data_context_get_context
(
dctx
);
struct
Sass_Options
*
ctx_opt
=
sass_context_get_options
(
ctx
);
sass_compile_data_context
(
dctx
);
}
void
compile_file
(
struct
Sass_File_Context
*
fctx
)
{
struct
Sass_Context
*
ctx
=
sass_file_context_get_context
(
fctx
);
struct
Sass_Options
*
ctx_opt
=
sass_context_get_options
(
ctx
);
sass_compile_file_context
(
fctx
);
}
void
free_data_context
(
struct
Sass_Data_Context
*
dctx
)
{
// delete[] dctx->source_string;
// delete[] dctx->options.include_paths;
// delete[] dctx->options.image_path;
sass_delete_data_context
(
dctx
);
}
}
void
free_file_context
(
s
ass_file_c
ontext
*
fctx
)
{
void
free_file_context
(
s
truct
Sass_File_C
ontext
*
fctx
)
{
delete
[]
fctx
->
input_path
;
//
delete[] fctx->input_path;
delete
[]
fctx
->
options
.
include_paths
;
//
delete[] fctx->options.include_paths;
delete
[]
fctx
->
options
.
image_path
;
//
delete[] fctx->options.image_path;
sass_
fre
e_file_context
(
fctx
);
sass_
delet
e_file_context
(
fctx
);
}
}
sass_context_wrapper
*
sass_
new
_context_wrapper
()
{
sass_context_wrapper
*
sass_
make
_context_wrapper
()
{
return
(
sass_context_wrapper
*
)
calloc
(
1
,
sizeof
(
sass_context_wrapper
));
return
(
sass_context_wrapper
*
)
calloc
(
1
,
sizeof
(
sass_context_wrapper
));
}
}
void
sass_free_context_wrapper
(
sass_context_wrapper
*
ctx_w
)
{
void
sass_free_context_wrapper
(
sass_context_wrapper
*
ctx_w
)
{
if
(
ctx_w
->
ctx
)
{
if
(
ctx_w
->
d
ctx
)
{
free_
context
(
ctx_w
->
ctx
);
free_
data_context
(
ctx_w
->
d
ctx
);
}
else
if
(
ctx_w
->
fctx
)
{
}
else
if
(
ctx_w
->
fctx
)
{
free_file_context
(
ctx_w
->
fctx
);
free_file_context
(
ctx_w
->
fctx
);
}
}
...
...
src/sass_context_wrapper.h
View file @
af72ccc4
#include "libsass/sass_interface.h"
#include <nan.h>
#include <nan.h>
#include "libsass/sass_context.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -7,20 +7,23 @@ extern "C" {
...
@@ -7,20 +7,23 @@ extern "C" {
using
namespace
v8
;
using
namespace
v8
;
void
free_context
(
sass_context
*
ctx
);
void
compile_data
(
struct
Sass_Data_Context
*
dctx
);
void
free_file_context
(
sass_file_context
*
fctx
);
void
compile_file
(
struct
Sass_File_Context
*
fctx
);
void
compile_it
(
uv_work_t
*
req
);
void
free_data_context
(
struct
Sass_Data_Context
*
dctx
);
void
free_file_context
(
struct
Sass_File_Context
*
fctx
);
struct
sass_context_wrapper
{
struct
sass_context_wrapper
{
sass_context
*
ctx
;
Sass_Data_Context
*
d
ctx
;
sass_file_c
ontext
*
fctx
;
Sass_File_C
ontext
*
fctx
;
Persistent
<
Object
>
stats
;
Persistent
<
Object
>
stats
;
uv_work_t
request
;
uv_work_t
request
;
NanCallback
*
callback
;
NanCallback
*
callback
;
NanCallback
*
errorCallback
;
NanCallback
*
errorCallback
;
};
};
struct
sass_context_wrapper
*
sass_
new
_context_wrapper
(
void
);
struct
sass_context_wrapper
*
sass_
make
_context_wrapper
(
void
);
void
sass_free_context_wrapper
(
struct
sass_context_wrapper
*
ctx
);
void
sass_free_context_wrapper
(
struct
sass_context_wrapper
*
ctx
_w
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
test/api.js
View file @
af72ccc4
...
@@ -187,8 +187,7 @@ describe('api', function() {
...
@@ -187,8 +187,7 @@ describe('api', function() {
var
stats
=
{};
var
stats
=
{};
var
expected
=
[
var
expected
=
[
fixture
(
'include-files/bar.scss'
).
replace
(
/
\\
/g
,
'/'
),
fixture
(
'include-files/bar.scss'
).
replace
(
/
\\
/g
,
'/'
),
fixture
(
'include-files/foo.scss'
).
replace
(
/
\\
/g
,
'/'
),
fixture
(
'include-files/foo.scss'
).
replace
(
/
\\
/g
,
'/'
)
'stdin'
];
];
sass
.
render
({
sass
.
render
({
...
...
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