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
9b752b27
Commit
9b752b27
authored
Jan 13, 2014
by
Steven Luscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the --image-path option to the cli interface.
parent
140b20c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
cli.js
lib/cli.js
+7
-0
render.js
lib/render.js
+1
-0
cli.js
test/cli.js
+12
-0
No files found.
lib/cli.js
View file @
9b752b27
...
...
@@ -21,6 +21,10 @@ var optimist = require('optimist')
describe
:
'Path to look for @import-ed files'
,
'default'
:
cwd
})
.
options
(
'image-path'
,
{
describe
:
'Path to prepend when using the image-url(…) helper'
,
'default'
:
''
})
.
options
(
'watch'
,
{
describe
:
'Watch a directory or file'
,
alias
:
'w'
...
...
@@ -97,6 +101,9 @@ exports = module.exports = function(args) {
options
.
includePaths
=
[
options
.
includePaths
];
}
// include the image path.
options
.
imagePath
=
argv
[
'image-path'
];
// if it's an array, make it a string
options
.
outputStyle
=
argv
[
'output-style'
];
if
(
Array
.
isArray
(
options
.
outputStyle
))
{
...
...
lib/render.js
View file @
9b752b27
...
...
@@ -7,6 +7,7 @@ function render(options, emitter) {
sass
.
render
({
file
:
options
.
inFile
,
includePaths
:
options
.
includePaths
,
imagePath
:
options
.
imagePath
,
outputStyle
:
options
.
outputStyle
,
sourceComments
:
options
.
sourceComments
,
sourceMap
:
options
.
sourceMap
,
...
...
test/cli.js
View file @
9b752b27
...
...
@@ -24,6 +24,9 @@ var expectedSampleNoComments = '#navbar {\n\
#navbar li a {
\
n
\
font-weight: bold; }
\
n'
;
var
expectedSampleCustomImagePath
=
'body {
\
n
\
background-image: url("/path/to/images/image.png"); }
\
n'
;
describe
(
'cli'
,
function
()
{
it
(
'should print help when run with no arguments'
,
function
(
done
)
{
exec
(
'node '
+
cliPath
,
function
(
err
,
stdout
,
stderr
)
{
...
...
@@ -90,6 +93,15 @@ describe('cli', function() {
});
});
it
(
'should compile with the --image-path option'
,
function
(
done
){
var
emitter
=
cli
([
'--image-path'
,
'/path/to/images'
,
path
.
join
(
__dirname
,
'image_path.scss'
)]);
emitter
.
on
(
'error'
,
done
);
emitter
.
on
(
'write'
,
function
(
err
,
file
,
css
){
assert
.
equal
(
css
,
expectedSampleCustomImagePath
);
fs
.
unlink
(
file
,
done
);
});
});
it
(
'should write the output to the file specified with the --output option'
,
function
(
done
){
var
resultPath
=
path
.
join
(
__dirname
,
'../output.css'
);
var
emitter
=
cli
([
'--output'
,
resultPath
,
path
.
join
(
__dirname
,
'sample.scss'
)]);
...
...
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