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
2c07e154
Commit
2c07e154
authored
Mar 03, 2015
by
Adeel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Resolve input, output and map w.r.t. cwd.
Issue URL: #731. Pull Request: #732.
parent
65619ba4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
32 deletions
+32
-32
index.js
lib/index.js
+32
-32
No files found.
lib/index.js
View file @
2c07e154
...
@@ -27,25 +27,48 @@ function getBinding() {
...
@@ -27,25 +27,48 @@ function getBinding() {
}
}
/**
/**
* Get
out
file
* Get
input
file
*
*
* @param {Object} options
* @param {Object} options
* @api private
* @api private
*/
*/
function
getOutFile
(
options
)
{
function
getInputFile
(
options
)
{
var
file
=
options
.
file
;
return
options
.
file
?
path
.
resolve
(
options
.
file
)
:
null
;
}
/**
* Get output file
*
* @param {Object} options
* @api private
*/
function
getOutputFile
(
options
)
{
var
outFile
=
options
.
outFile
;
var
outFile
=
options
.
outFile
;
if
(
!
outFile
||
typeof
outFile
!==
'string'
||
(
!
options
.
data
&&
!
file
))
{
if
(
!
outFile
||
typeof
outFile
!==
'string'
||
(
!
options
.
data
&&
!
options
.
file
))
{
return
null
;
return
null
;
}
}
if
(
path
.
resolve
(
outFile
)
===
path
.
normalize
(
outFile
).
replace
(
/
(
.+
)([\/
|
\\])
$/
,
'$1'
))
{
return
path
.
resolve
(
outFile
);
return
outFile
;
}
/**
* Get source map
*
* @param {Object} options
* @api private
*/
function
getSourceMap
(
options
)
{
var
sourceMap
=
options
.
sourceMap
;
if
(
sourceMap
&&
typeof
sourceMap
!==
'string'
&&
options
.
outFile
)
{
sourceMap
=
options
.
outFile
+
'.map'
;
}
}
return
path
.
resolve
(
path
.
dirname
(
file
),
outFile
)
;
return
sourceMap
?
path
.
resolve
(
sourceMap
)
:
null
;
}
}
/**
/**
...
@@ -99,29 +122,6 @@ function getStyle(options) {
...
@@ -99,29 +122,6 @@ function getStyle(options) {
}
}
/**
/**
* Get source map
*
* @param {Object} options
* @api private
*/
function
getSourceMap
(
options
)
{
var
file
=
options
.
file
;
var
outFile
=
options
.
outFile
;
var
sourceMap
=
options
.
sourceMap
;
if
(
sourceMap
)
{
if
(
typeof
sourceMap
!==
'string'
)
{
sourceMap
=
outFile
?
outFile
+
'.map'
:
''
;
}
else
if
(
outFile
)
{
sourceMap
=
path
.
resolve
(
path
.
dirname
(
file
),
sourceMap
);
}
}
return
sourceMap
;
}
/**
* Get options
* Get options
*
*
* @param {Object} options
* @param {Object} options
...
@@ -132,8 +132,8 @@ function getOptions(options, cb) {
...
@@ -132,8 +132,8 @@ function getOptions(options, cb) {
options
=
options
||
{};
options
=
options
||
{};
options
.
sourceComments
=
options
.
sourceComments
||
false
;
options
.
sourceComments
=
options
.
sourceComments
||
false
;
options
.
data
=
options
.
data
||
null
;
options
.
data
=
options
.
data
||
null
;
options
.
file
=
options
.
file
||
null
;
options
.
file
=
getInputFile
(
options
)
;
options
.
outFile
=
getOutFile
(
options
);
options
.
outFile
=
getOut
put
File
(
options
);
options
.
includePaths
=
(
options
.
includePaths
||
[]).
join
(
path
.
delimiter
);
options
.
includePaths
=
(
options
.
includePaths
||
[]).
join
(
path
.
delimiter
);
options
.
precision
=
parseInt
(
options
.
precision
)
||
5
;
options
.
precision
=
parseInt
(
options
.
precision
)
||
5
;
options
.
sourceMap
=
getSourceMap
(
options
);
options
.
sourceMap
=
getSourceMap
(
options
);
...
...
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