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
ee39376a
Commit
ee39376a
authored
Jun 06, 2014
by
John Oberreuter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding support for passing a precision option to libsass
parent
11cb9598
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
0 deletions
+25
-0
binding.cpp
binding.cpp
+2
-0
cli.js
lib/cli.js
+6
-0
render.js
lib/render.js
+1
-0
sass.js
sass.js
+1
-0
test.js
test/test.js
+15
-0
No files found.
binding.cpp
View file @
ee39376a
...
...
@@ -54,6 +54,7 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper*
if
(
source_comments
==
SASS_SOURCE_COMMENTS_MAP
)
{
ctx
->
source_map_file
=
CreateString
(
options
->
Get
(
NanSymbol
(
"sourceMap"
)));
}
ctx
->
options
.
precision
=
options
->
Get
(
NanSymbol
(
"precision"
))
->
Int32Value
();
}
else
{
sass_context
*
ctx
=
(
sass_context
*
)
cptr
;
ctx
->
source_string
=
CreateString
(
options
->
Get
(
NanSymbol
(
"data"
)));
...
...
@@ -61,6 +62,7 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper*
ctx
->
options
.
output_style
=
options
->
Get
(
NanSymbol
(
"style"
))
->
Int32Value
();
ctx
->
options
.
source_comments
=
source_comments
=
options
->
Get
(
NanSymbol
(
"comments"
))
->
Int32Value
();
ctx
->
options
.
include_paths
=
CreateString
(
options
->
Get
(
NanSymbol
(
"paths"
)));
ctx
->
options
.
precision
=
options
->
Get
(
NanSymbol
(
"precision"
))
->
Int32Value
();
}
}
...
...
lib/cli.js
View file @
ee39376a
...
...
@@ -25,6 +25,10 @@ var optimist = require('optimist')
describe
:
'Path to prepend when using the image-url(…) helper'
,
'default'
:
''
})
.
options
(
'precision'
,
{
describe
:
'The amount of precision allowed in decimal numbers'
,
'default'
:
5
})
.
options
(
'watch'
,
{
describe
:
'Watch a directory or file'
,
alias
:
'w'
...
...
@@ -131,6 +135,8 @@ exports = module.exports = function(args) {
}
}
options
.
precision
=
argv
.
precision
;
if
(
argv
.
w
)
{
var
watchDir
=
argv
.
w
;
...
...
lib/render.js
View file @
ee39376a
...
...
@@ -11,6 +11,7 @@ function render(options, emitter) {
outputStyle
:
options
.
outputStyle
,
sourceComments
:
options
.
sourceComments
,
sourceMap
:
options
.
sourceMap
,
precision
:
options
.
precision
,
success
:
function
(
css
,
sourceMap
)
{
var
todo
=
1
;
...
...
sass.js
View file @
ee39376a
...
...
@@ -64,6 +64,7 @@ var prepareOptions = function (options) {
comments
:
SASS_SOURCE_COMMENTS
[
sourceComments
]
||
0
,
stats
:
stats
,
sourceMap
:
options
.
sourceMap
,
precision
:
parseInt
(
options
.
precision
)
||
5
,
success
:
function
onSuccess
(
css
,
sourceMap
)
{
finishStats
(
stats
,
sourceMap
);
success
&&
success
(
css
,
sourceMap
);
...
...
test/test.js
View file @
ee39376a
...
...
@@ -261,3 +261,18 @@ describe('render to file', function() {
});
});
describe
(
'precision support'
,
function
()
{
it
(
'should render when precision is specified'
,
function
(
done
)
{
sass
.
render
({
data
:
'.test { margin: 1.23456789 px; }'
,
precision
:
10
,
success
:
function
(
css
)
{
done
(
assert
.
equal
(
css
,
'.test {
\
n margin: 1.23456789 px; }
\
n'
));
},
error
:
function
(
error
)
{
done
(
error
);
}
});
});
});
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