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
0f9ff916
Commit
0f9ff916
authored
Oct 10, 2014
by
Andrew Nesbitt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #452 from am11/master
Feature: Supports indented code with stdin or data
parents
da55f452
f8911974
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
9 deletions
+38
-9
binding.cpp
binding.cpp
+1
-0
cli.js
lib/cli.js
+7
-7
render.js
lib/render.js
+1
-0
libsass
libsass
+1
-1
sass.js
sass.js
+1
-0
cli.js
test/cli.js
+23
-0
indented.sass
test/indented.sass
+3
-0
sass-spec
test/sass-spec
+1
-1
No files found.
binding.cpp
View file @
0f9ff916
...
...
@@ -65,6 +65,7 @@ void ExtractOptions(Local<Value> optionsValue, void* cptr, sass_context_wrapper*
sass_context
*
ctx
=
(
sass_context
*
)
cptr
;
ctx
->
source_string
=
CreateString
(
options
->
Get
(
NanNew
(
"data"
)));
ctx
->
output_path
=
CreateString
(
options
->
Get
(
NanNew
(
"outFile"
)));
ctx
->
options
.
is_indented_syntax_src
=
options
->
Get
(
NanNew
(
"indentedSyntax"
))
->
BooleanValue
();
ctx
->
options
.
image_path
=
CreateString
(
options
->
Get
(
NanNew
(
"imagePath"
)));
ctx
->
options
.
output_style
=
options
->
Get
(
NanNew
(
"style"
))
->
Int32Value
();
ctx
->
options
.
source_comments
=
source_comments
=
options
->
Get
(
NanNew
(
"comments"
))
->
BooleanValue
();
...
...
lib/cli.js
View file @
0f9ff916
var
watch
=
require
(
'node-watch'
),
var
watch
=
require
(
'node-watch'
),
render
=
require
(
'./render'
),
path
=
require
(
'path'
),
Emitter
=
require
(
'events'
).
EventEmitter
,
...
...
@@ -49,6 +49,11 @@ var yargs = require('yargs')
type
:
'boolean'
,
alias
:
'x'
})
.
options
(
'indented-syntax'
,
{
describe
:
'Treat data from stdin as sass code (versus scss)'
,
type
:
'boolean'
,
alias
:
'i'
})
.
options
(
'help'
,
{
describe
:
'Print usage info'
,
type
:
'string'
,
...
...
@@ -93,13 +98,7 @@ function run(options, emitter) {
options
.
sourceComments
=
options
.
sourceComments
[
0
];
}
if
(
options
.
sourceComments
===
'map'
&&
!
options
.
sourceMap
)
{
options
.
sourceMap
=
true
;
}
if
(
options
.
sourceMap
)
{
options
.
sourceComments
=
'map'
;
if
(
options
.
sourceMap
===
true
)
{
options
.
sourceMap
=
options
.
dest
+
'.map'
;
}
else
{
...
...
@@ -140,6 +139,7 @@ module.exports = function(args) {
imagePath
:
argv
[
'image-path'
],
includePaths
:
argv
[
'include-path'
],
omitSourceMapUrl
:
argv
[
'omit-source-map-url'
],
indentedSyntax
:
argv
[
'indented-syntax'
],
outputStyle
:
argv
[
'output-style'
],
precision
:
argv
.
precision
,
sourceComments
:
argv
[
'source-comments'
],
...
...
lib/render.js
View file @
0f9ff916
...
...
@@ -7,6 +7,7 @@ function render(options, emitter) {
imagePath
:
options
.
imagePath
,
includePaths
:
options
.
includePaths
,
omitSourceMapUrl
:
options
.
omitSourceMapUrl
,
indentedSyntax
:
options
.
indentedSyntax
,
outFile
:
options
.
outFile
,
outputStyle
:
options
.
outputStyle
,
precision
:
options
.
precision
,
...
...
libsass
@
27d4fcd9
Subproject commit
859d11d53b9bf5d9bf63d861a547222c0f485cd9
Subproject commit
27d4fcd92db501d0662696f08942f35499717f53
sass.js
View file @
0f9ff916
...
...
@@ -83,6 +83,7 @@ var prepareOptions = function (options) {
style
:
SASS_OUTPUT_STYLE
[
options
.
output_style
||
options
.
outputStyle
]
||
0
,
comments
:
SASS_SOURCE_COMMENTS
[
sourceComments
]
||
false
,
omitSourceMapUrl
:
options
.
omitSourceMapUrl
,
indentedSyntax
:
options
.
indentedSyntax
,
stats
:
stats
,
sourceMap
:
sourceMap
,
precision
:
parseInt
(
options
.
precision
)
||
5
,
...
...
test/cli.js
View file @
0f9ff916
...
...
@@ -64,6 +64,17 @@ describe('cli', function() {
src
.
pipe
(
emitter
.
stdin
);
});
it
(
'should treat data as indented code (.sass) if --indented-syntax flag is used'
,
function
(
done
)
{
this
.
timeout
(
6000
);
var
src
=
fs
.
createReadStream
(
path
.
join
(
__dirname
,
'indented.sass'
));
var
emitter
=
spawn
(
cliPath
,
[
'--stdout'
,
'--indented-syntax'
]);
// when hit the callback in the following,
// it means that data is recieved, so we are ok to go.
emitter
.
stdout
.
on
(
'data'
,
function
()
{
done
();
});
src
.
pipe
(
emitter
.
stdin
);
});
it
(
'should print help when run with no arguments'
,
function
(
done
)
{
var
env
=
assign
(
process
.
env
,
{
isTTY
:
true
});
exec
(
'node '
+
cliPath
,
{
...
...
@@ -258,4 +269,16 @@ describe('cli', function() {
});
});
});
it
(
'should omit a sourceMappingURL from CSS if --omit-source-map-url flag is used'
,
function
(
done
)
{
var
emitter
=
cli
([
sampleScssPath
,
'--source-map'
,
path
.
join
(
__dirname
,
'../sample.map'
),
'--omit-source-map-url'
]);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'done'
,
function
()
{
fs
.
exists
(
sampleCssOutputPath
,
function
(
exists
)
{
assert
.
ok
(
fs
.
readFileSync
(
sampleCssOutputPath
,
'utf8'
).
indexOf
(
'sourceMappingURL='
)
===
-
1
);
if
(
exists
)
{
fs
.
unlinkSync
(
sampleCssOutputPath
);}
done
();
});
});
});
});
test/indented.sass
0 → 100644
View file @
0f9ff916
foo
+
bar
color
:
red
sass-spec
@
0882c309
Subproject commit
a1e8aa6b70101943acd5dd0d48711fa921f7c42c
Subproject commit
0882c3093cba708ea419e521fb48a272ab6b8b6d
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