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
79c6eb93
Commit
79c6eb93
authored
Mar 02, 2015
by
Adeel Mujahid
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #727 from am11/master
Code: Improvements
parents
a0691b1b
730a1341
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
32 deletions
+27
-32
index.js
lib/index.js
+25
-30
binding.cpp
src/binding.cpp
+2
-2
No files found.
lib/index.js
View file @
79c6eb93
...
...
@@ -130,11 +130,11 @@ function getSourceMap(options) {
function
getOptions
(
options
,
cb
)
{
options
=
options
||
{};
options
.
c
omments
=
options
.
sourceComments
||
false
;
options
.
sourceC
omments
=
options
.
sourceComments
||
false
;
options
.
data
=
options
.
data
||
null
;
options
.
file
=
options
.
file
||
null
;
options
.
outFile
=
getOutFile
(
options
);
options
.
p
aths
=
(
options
.
includePaths
||
[]).
join
(
path
.
delimiter
);
options
.
includeP
aths
=
(
options
.
includePaths
||
[]).
join
(
path
.
delimiter
);
options
.
precision
=
parseInt
(
options
.
precision
)
||
5
;
options
.
sourceMap
=
getSourceMap
(
options
);
options
.
style
=
getStyle
(
options
)
||
0
;
...
...
@@ -142,34 +142,6 @@ function getOptions(options, cb) {
// context object represents node-sass environment
options
.
context
=
{
options
:
options
,
callback
:
cb
};
// options.error and options.success are for libsass binding
options
.
error
=
function
(
err
)
{
var
payload
=
util
.
_extend
(
new
Error
(),
JSON
.
parse
(
err
));
if
(
cb
)
{
options
.
context
.
callback
.
call
(
options
.
context
,
payload
,
null
);
}
};
options
.
success
=
function
()
{
var
result
=
options
.
result
;
var
stats
=
endStats
(
result
.
stats
);
var
payload
=
{
css
:
result
.
css
,
map
:
result
.
map
,
stats
:
stats
};
if
(
cb
)
{
options
.
context
.
callback
.
call
(
options
.
context
,
null
,
payload
);
}
};
delete
options
.
include_paths
;
delete
options
.
includePaths
;
delete
options
.
source_comments
;
delete
options
.
sourceComments
;
options
.
result
=
{
stats
:
getStats
(
options
)
};
...
...
@@ -193,6 +165,29 @@ var binding = require(getBinding());
module
.
exports
.
render
=
function
(
options
,
cb
)
{
options
=
getOptions
(
options
,
cb
);
// options.error and options.success are for libsass binding
options
.
error
=
function
(
err
)
{
var
payload
=
util
.
_extend
(
new
Error
(),
JSON
.
parse
(
err
));
if
(
cb
)
{
options
.
context
.
callback
.
call
(
options
.
context
,
payload
,
null
);
}
};
options
.
success
=
function
()
{
var
result
=
options
.
result
;
var
stats
=
endStats
(
result
.
stats
);
var
payload
=
{
css
:
result
.
css
,
map
:
result
.
map
,
stats
:
stats
};
if
(
cb
)
{
options
.
context
.
callback
.
call
(
options
.
context
,
null
,
payload
);
}
};
var
importer
=
options
.
importer
;
if
(
importer
)
{
...
...
src/binding.cpp
View file @
79c6eb93
...
...
@@ -153,12 +153,12 @@ void extract_options(Local<Object> options, void* cptr, sass_context_wrapper* ct
sass_option_set_output_path
(
sass_options
,
create_string
(
options
->
Get
(
NanNew
(
"outFile"
))));
sass_option_set_output_style
(
sass_options
,
(
Sass_Output_Style
)
options
->
Get
(
NanNew
(
"style"
))
->
Int32Value
());
sass_option_set_is_indented_syntax_src
(
sass_options
,
options
->
Get
(
NanNew
(
"indentedSyntax"
))
->
BooleanValue
());
sass_option_set_source_comments
(
sass_options
,
options
->
Get
(
NanNew
(
"
c
omments"
))
->
BooleanValue
());
sass_option_set_source_comments
(
sass_options
,
options
->
Get
(
NanNew
(
"
sourceC
omments"
))
->
BooleanValue
());
sass_option_set_omit_source_map_url
(
sass_options
,
options
->
Get
(
NanNew
(
"omitSourceMapUrl"
))
->
BooleanValue
());
sass_option_set_source_map_embed
(
sass_options
,
options
->
Get
(
NanNew
(
"sourceMapEmbed"
))
->
BooleanValue
());
sass_option_set_source_map_contents
(
sass_options
,
options
->
Get
(
NanNew
(
"sourceMapContents"
))
->
BooleanValue
());
sass_option_set_source_map_file
(
sass_options
,
create_string
(
options
->
Get
(
NanNew
(
"sourceMap"
))));
sass_option_set_include_path
(
sass_options
,
create_string
(
options
->
Get
(
NanNew
(
"
p
aths"
))));
sass_option_set_include_path
(
sass_options
,
create_string
(
options
->
Get
(
NanNew
(
"
includeP
aths"
))));
sass_option_set_precision
(
sass_options
,
options
->
Get
(
NanNew
(
"precision"
))
->
Int32Value
());
}
...
...
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