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
686e6b3f
Commit
686e6b3f
authored
Apr 14, 2014
by
Andrew Nesbitt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #281 from djanowski/cleaner-binding-detection
Cleaner detection of bindings with better error handling.
parents
4180123c
978e11d2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
sass.js
sass.js
+18
-15
No files found.
sass.js
View file @
686e6b3f
var
binding
;
var
fs
=
require
(
'fs'
);
var
path
=
require
(
'path'
);
var
v8
=
'v8-'
+
/
[
0-9
]
+
\.[
0-9
]
+/
.
exec
(
process
.
versions
.
v8
)[
0
];
var
modPath
=
path
.
join
(
__dirname
,
'bin'
,
process
.
platform
+
'-'
+
process
.
arch
+
'-'
+
v8
,
'binding'
);
try
{
if
(
fs
.
realpathSync
(
__dirname
+
'/build'
))
{
// use the build version if it exists
binding
=
require
(
__dirname
+
'/build/Release/binding'
);
function
requireBinding
()
{
var
fs
=
require
(
'fs'
);
var
v8
=
'v8-'
+
/
[
0-9
]
+
\.[
0-9
]
+/
.
exec
(
process
.
versions
.
v8
)[
0
];
var
candidates
=
[
[
__dirname
,
'build'
,
'Release'
,
'obj.target'
,
'binding.node'
],
[
__dirname
,
'bin'
,
process
.
platform
+
'-'
+
process
.
arch
+
'-'
+
v8
,
'binding.node'
],
];
for
(
var
i
=
0
,
l
=
candidates
.
length
;
i
<
l
;
i
++
)
{
var
candidate
=
path
.
join
.
apply
(
path
.
join
,
candidates
[
i
]);
if
(
fs
.
existsSync
(
candidate
))
{
return
require
(
candidate
);
}
}
catch
(
e
)
{
try
{
fs
.
realpathSync
(
modPath
+
'.node'
);
binding
=
require
(
modPath
);
}
catch
(
ex
)
{
// No binary!
throw
new
Error
(
'`'
+
modPath
+
'.node` is missing. Try reinstalling `node-sass`?'
);
}
throw
new
Error
(
'`libsass` bindings not found. Try reinstalling `node-sass`?'
);
}
var
binding
=
requireBinding
();
var
SASS_OUTPUT_STYLE
=
{
nested
:
0
,
expanded
:
1
,
...
...
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