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
2aa5bb69
Commit
2aa5bb69
authored
Mar 18, 2015
by
Adeel Mujahid
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #770 from am11/master
Code: Parses arguments manually
parents
516e5742
a3b826d3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
+27
-7
extensions.js
lib/extensions.js
+26
-6
api.js
test/api.js
+1
-1
No files found.
lib/extensions.js
View file @
2aa5bb69
...
@@ -3,12 +3,30 @@
...
@@ -3,12 +3,30 @@
*/
*/
var
eol
=
require
(
'os'
).
EOL
,
var
eol
=
require
(
'os'
).
EOL
,
flags
=
require
(
'meow'
)({
pkg
:
'../package.json'
}).
flags
,
flags
=
{}
,
fs
=
require
(
'fs'
),
fs
=
require
(
'fs'
),
package
=
require
(
'../package.json'
),
package
=
require
(
'../package.json'
),
path
=
require
(
'path'
);
path
=
require
(
'path'
);
/**
/**
* Collect Arguments
*
* @param {Array} args
* @api private
*/
function
collectArguments
(
args
)
{
for
(
var
i
=
0
;
i
<
args
.
length
;
i
+=
2
)
{
if
(
args
[
i
].
lastIndexOf
(
'--'
,
0
)
!==
0
)
{
--
i
;
continue
;
}
flags
[
args
[
i
]]
=
args
[
i
+
1
];
}
}
/**
* Get Runtime Info
* Get Runtime Info
*
*
* @api private
* @api private
...
@@ -42,8 +60,8 @@ function getRuntimeInfo() {
...
@@ -42,8 +60,8 @@ function getRuntimeInfo() {
function
getBinaryName
()
{
function
getBinaryName
()
{
var
binaryName
;
var
binaryName
;
if
(
flags
.
binaryName
)
{
if
(
flags
[
'--sass-binary-name'
]
)
{
binaryName
=
flags
.
binaryName
;
binaryName
=
flags
[
'--sass-binary-name'
]
;
}
else
if
(
package
.
nodeSassConfig
&&
package
.
nodeSassConfig
.
binaryName
)
{
}
else
if
(
package
.
nodeSassConfig
&&
package
.
nodeSassConfig
.
binaryName
)
{
binaryName
=
package
.
nodeSassConfig
.
binaryName
;
binaryName
=
package
.
nodeSassConfig
.
binaryName
;
}
else
if
(
process
.
env
.
SASS_BINARY_NAME
)
{
}
else
if
(
process
.
env
.
SASS_BINARY_NAME
)
{
...
@@ -68,7 +86,7 @@ function getBinaryName() {
...
@@ -68,7 +86,7 @@ function getBinaryName() {
*/
*/
function
getBinaryUrl
()
{
function
getBinaryUrl
()
{
return
flags
.
binaryUrl
||
return
flags
[
'--sass-binary-url'
]
||
package
.
nodeSassConfig
?
package
.
nodeSassConfig
.
binaryUrl
:
null
||
package
.
nodeSassConfig
?
package
.
nodeSassConfig
.
binaryUrl
:
null
||
process
.
env
.
SASS_BINARY_URL
||
process
.
env
.
SASS_BINARY_URL
||
[
'https://github.com/sass/node-sass/releases/download//v'
,
[
'https://github.com/sass/node-sass/releases/download//v'
,
...
@@ -88,6 +106,8 @@ function getVersionInfo() {
...
@@ -88,6 +106,8 @@ function getVersionInfo() {
].
join
(
eol
);
].
join
(
eol
);
}
}
collectArguments
(
process
.
argv
.
slice
(
2
));
var
sass
=
process
.
sass
=
{};
var
sass
=
process
.
sass
=
{};
sass
.
binaryName
=
getBinaryName
();
sass
.
binaryName
=
getBinaryName
();
...
@@ -112,8 +132,8 @@ sass.versionInfo = getVersionInfo();
...
@@ -112,8 +132,8 @@ sass.versionInfo = getVersionInfo();
sass
.
getBinaryPath
=
function
(
throwIfNotExists
)
{
sass
.
getBinaryPath
=
function
(
throwIfNotExists
)
{
var
binaryPath
;
var
binaryPath
;
if
(
flags
.
binaryPath
)
{
if
(
flags
[
'--sass-binary-path'
]
)
{
binaryPath
=
flags
.
binaryPath
;
binaryPath
=
flags
[
'--sass-binary-path'
]
;
}
else
if
(
package
.
nodeSassConfig
&&
package
.
nodeSassConfig
.
binaryPath
)
{
}
else
if
(
package
.
nodeSassConfig
&&
package
.
nodeSassConfig
.
binaryPath
)
{
binaryPath
=
package
.
nodeSassConfig
.
binaryPath
;
binaryPath
=
package
.
nodeSassConfig
.
binaryPath
;
}
else
if
(
process
.
env
.
SASS_BINARY_PATH
)
{
}
else
if
(
process
.
env
.
SASS_BINARY_PATH
)
{
...
...
test/api.js
View file @
2aa5bb69
...
@@ -762,7 +762,7 @@ describe('api', function() {
...
@@ -762,7 +762,7 @@ describe('api', function() {
delete
require
.
cache
[
extensionsPath
];
delete
require
.
cache
[
extensionsPath
];
process
.
argv
=
argv
.
concat
([
'--
binary-name'
,
'foo'
,
'-
-binary-path'
,
'bar'
]);
process
.
argv
=
argv
.
concat
([
'--
sass-binary-name'
,
'foo'
,
'--sass
-binary-path'
,
'bar'
]);
require
(
extensionsPath
);
require
(
extensionsPath
);
...
...
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