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
4bea0703
Commit
4bea0703
authored
Dec 18, 2014
by
Adeel Mujahid
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #576 from am11/importer
Feature: Custom importer (#530)
parents
7c354bf6
5a6bd67f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
17 deletions
+50
-17
index.js
lib/index.js
+12
-0
binding.cpp
src/binding.cpp
+0
-0
libsass
src/libsass
+1
-1
sass_context_wrapper.cpp
src/sass_context_wrapper.cpp
+18
-5
sass_context_wrapper.h
src/sass_context_wrapper.h
+18
-10
spec
test/fixtures/spec
+1
-1
No files found.
lib/index.js
View file @
4bea0703
...
...
@@ -150,6 +150,7 @@ function getOptions(options) {
var
error
=
options
.
error
;
var
success
=
options
.
success
;
var
importer
=
options
.
importer
;
options
.
error
=
function
(
err
,
code
)
{
try
{
...
...
@@ -173,6 +174,17 @@ function getOptions(options) {
}
};
if
(
importer
)
{
options
.
importer
=
function
(
file
,
prev
,
key
)
{
importer
(
file
,
prev
,
function
(
data
)
{
binding
.
importedCallback
({
index
:
key
,
objectLiteral
:
data
});
});
};
}
delete
options
.
image_path
;
delete
options
.
include_paths
;
delete
options
.
includePaths
;
...
...
src/binding.cpp
View file @
4bea0703
This diff is collapsed.
Click to expand it.
libsass
@
7aaa45a9
Subproject commit
5f3558d7ce36bb61202f1585ed8e32a52209e940
Subproject commit
7aaa45a979ce65d50b3158ff50bf9409f8955063
src/sass_context_wrapper.cpp
View file @
4bea0703
...
...
@@ -8,7 +8,8 @@ extern "C" {
if
(
ctx_w
->
dctx
)
{
compile_data
(
ctx_w
->
dctx
);
}
else
if
(
ctx_w
->
fctx
)
{
}
else
if
(
ctx_w
->
fctx
)
{
compile_file
(
ctx_w
->
fctx
);
}
}
...
...
@@ -22,19 +23,31 @@ extern "C" {
}
sass_context_wrapper
*
sass_make_context_wrapper
()
{
return
(
sass_context_wrapper
*
)
calloc
(
1
,
sizeof
(
sass_context_wrapper
));
auto
ctx_w
=
(
sass_context_wrapper
*
)
calloc
(
1
,
sizeof
(
sass_context_wrapper
));
uv_mutex_init
(
&
ctx_w
->
importer_mutex
);
uv_cond_init
(
&
ctx_w
->
importer_condition_variable
);
return
ctx_w
;
}
void
sass_free_context_wrapper
(
sass_context_wrapper
*
ctx_w
)
{
if
(
ctx_w
->
dctx
)
{
sass_delete_data_context
(
ctx_w
->
dctx
);
}
else
if
(
ctx_w
->
fctx
)
{
}
else
if
(
ctx_w
->
fctx
)
{
sass_delete_file_context
(
ctx_w
->
fctx
);
}
NanDisposePersistent
(
ctx_w
->
stats
);
delete
ctx_w
->
callback
;
delete
ctx_w
->
errorCallback
;
delete
ctx_w
->
success_callback
;
delete
ctx_w
->
error_callback
;
delete
ctx_w
->
importer_callback
;
delete
ctx_w
->
file
;
delete
ctx_w
->
prev
;
delete
ctx_w
->
cookie
;
uv_mutex_destroy
(
&
ctx_w
->
importer_mutex
);
uv_cond_destroy
(
&
ctx_w
->
importer_condition_variable
);
free
(
ctx_w
);
}
...
...
src/sass_context_wrapper.h
View file @
4bea0703
...
...
@@ -5,23 +5,31 @@
extern
"C"
{
#endif
using
namespace
v8
;
using
namespace
v8
;
void
compile_data
(
struct
Sass_Data_Context
*
dctx
);
void
compile_file
(
struct
Sass_File_Context
*
fctx
);
void
compile_it
(
uv_work_t
*
req
);
void
compile_data
(
struct
Sass_Data_Context
*
dctx
);
void
compile_file
(
struct
Sass_File_Context
*
fctx
);
void
compile_it
(
uv_work_t
*
req
);
struct
sass_context_wrapper
{
struct
sass_context_wrapper
{
Sass_Data_Context
*
dctx
;
Sass_File_Context
*
fctx
;
Persistent
<
Object
>
stats
;
uv_work_t
request
;
NanCallback
*
callback
;
NanCallback
*
errorCallback
;
};
uv_mutex_t
importer_mutex
;
uv_cond_t
importer_condition_variable
;
uv_async_t
async
;
const
char
*
file
;
const
char
*
prev
;
void
*
cookie
;
Sass_Import
**
imports
;
NanCallback
*
success_callback
;
NanCallback
*
error_callback
;
NanCallback
*
importer_callback
;
};
struct
sass_context_wrapper
*
sass_make_context_wrapper
(
void
);
void
sass_free_context_wrapper
(
struct
sass_context_wrapper
*
ctx_w
);
struct
sass_context_wrapper
*
sass_make_context_wrapper
(
void
);
void
sass_free_context_wrapper
(
struct
sass_context_wrapper
*
ctx_w
);
#ifdef __cplusplus
}
...
...
spec
@
074ae3b2
Subproject commit
b85c617a0e7e5367dd347b0b301ad1c15b6d5087
Subproject commit
074ae3b24bfc3ff19a98efdec02415ed6fd5759a
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