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
1b2dd431
Commit
1b2dd431
authored
Apr 22, 2014
by
XhmikosR
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up JSHint's options.
parent
faed0cc4
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
59 deletions
+60
-59
.jshintrc
.jshintrc
+16
-11
build.js
build.js
+1
-1
middleware.js
lib/middleware.js
+4
-4
source_comments_spec.js
test/source_comments_spec.js
+2
-3
source_map_spec.js
test/source_map_spec.js
+2
-3
test.js
test/test.js
+35
-37
No files found.
.jshintrc
View file @
1b2dd431
{
"node": true,
"laxbreak": true,
"indent": 2,
"bitwise": true,
"camelcase": false,
"curly": true,
"trailing": true,
"undef": true,
"unused": true,
"expr":true,
"eqeqeq": true,
"expr": true,
"immed": true,
"indent": 2,
"laxbreak": true,
"mocha": true,
"multistr": true,
"globals": {
"it": true,
"describe": true
}
"newcap": true,
"noarg": true,
"node": true,
"quotmark": "single",
"strict": false,
"undef": true,
"unused": true
}
\ No newline at end of file
build.js
View file @
1b2dd431
...
...
@@ -40,7 +40,7 @@ if (!force && !process.env.SKIP_NODE_SASS_TESTS) {
timeout
:
999999
});
mocha
.
addFile
(
path
.
resolve
(
__dirname
,
"test"
,
"test.js"
));
mocha
.
addFile
(
path
.
resolve
(
__dirname
,
'test'
,
'test.js'
));
mocha
.
run
(
function
(
done
)
{
if
(
done
!==
0
)
{
...
...
lib/middleware.js
View file @
1b2dd431
...
...
@@ -44,7 +44,7 @@ module.exports = function(options){
options
=
options
||
{};
// Accept src/dest dir
if
(
'string'
==
typeof
options
)
{
if
(
'string'
==
=
typeof
options
)
{
options
=
{
src
:
options
};
}
...
...
@@ -72,7 +72,7 @@ module.exports = function(options){
// Middleware
return
function
sass
(
req
,
res
,
next
){
if
(
'GET'
!=
req
.
method
&&
'HEAD'
!
=
req
.
method
)
{
return
next
();
}
if
(
'GET'
!=
=
req
.
method
&&
'HEAD'
!=
=
req
.
method
)
{
return
next
();
}
var
path
=
url
.
parse
(
req
.
url
).
pathname
;
if
(
options
.
prefix
&&
0
===
path
.
indexOf
(
options
.
prefix
))
{
path
=
path
.
substring
(
options
.
prefix
.
length
);
...
...
@@ -97,7 +97,7 @@ module.exports = function(options){
// Ignore ENOENT to fall through as 404
var
error
=
function
(
err
)
{
next
(
'ENOENT'
==
err
.
code
next
(
'ENOENT'
==
=
err
.
code
?
null
:
err
);
};
...
...
@@ -139,7 +139,7 @@ module.exports = function(options){
fs
.
stat
(
cssPath
,
function
(
err
,
cssStats
){
// CSS has not been compiled, compile it!
if
(
err
)
{
if
(
'ENOENT'
==
err
.
code
)
{
if
(
'ENOENT'
==
=
err
.
code
)
{
if
(
debug
)
{
log
(
'not found'
,
cssPath
);
}
compile
();
}
else
{
...
...
test/source_comments_spec.js
View file @
1b2dd431
/*jshint multistr:true */
var
sass
=
require
(
'../sass'
);
var
assert
=
require
(
'assert'
);
...
...
@@ -20,8 +19,8 @@ var expectedCommentsScssStr = '/* line 1, ' + sampleFilename + ' */\n\
#navbar li a {
\
n
\
font-weight: bold; }
\
n'
;
describe
(
"compile file with source comments"
,
function
()
{
it
(
"should compile with render and comment outputs"
,
function
(
done
)
{
describe
(
'compile file with source comments'
,
function
()
{
it
(
'should compile with render and comment outputs'
,
function
(
done
)
{
sass
.
render
({
file
:
sampleFilename
,
source_comments
:
'normal'
,
...
...
test/source_map_spec.js
View file @
1b2dd431
/*jshint multistr:true */
var
sass
=
require
(
'../sass'
);
var
assert
=
require
(
'assert'
);
var
sampleFilename
=
require
(
'path'
).
resolve
(
__dirname
,
'sample.scss'
);
describe
(
"compile source maps"
,
function
()
{
it
(
"should compile file with source map URL"
,
function
(
done
)
{
describe
(
'compile source maps'
,
function
()
{
it
(
'should compile file with source map URL'
,
function
(
done
)
{
var
mapFileName
=
'sample.css.map'
;
sass
.
render
({
file
:
sampleFilename
,
...
...
test/test.js
View file @
1b2dd431
/* global beforeEach, afterEach */
/*jshint multistr:true */
var
sass
=
process
.
env
.
NODESASS_COVERAGE
?
require
(
'../sass-coverage'
)
:
require
(
'../sass'
);
var
assert
=
require
(
'assert'
);
var
path
=
require
(
'path'
);
...
...
@@ -39,18 +37,18 @@ var expectedRender = '#navbar {\n\
#navbar li a {
\
n
\
font-weight: bold; }
\
n'
;
describe
(
"DEPRECATED: compile scss"
,
function
()
{
it
(
"should compile with render"
,
function
(
done
)
{
describe
(
'DEPRECATED: compile scss'
,
function
()
{
it
(
'should compile with render'
,
function
(
done
)
{
sass
.
render
(
scssStr
,
function
(
err
)
{
done
(
err
);
});
});
it
(
"should compile with renderSync"
,
function
(
done
)
{
it
(
'should compile with renderSync'
,
function
(
done
)
{
done
(
assert
.
ok
(
sass
.
renderSync
(
scssStr
)));
});
it
(
"should match compiled string with render"
,
function
(
done
)
{
it
(
'should match compiled string with render'
,
function
(
done
)
{
sass
.
render
(
scssStr
,
function
(
err
,
css
)
{
if
(
!
err
)
{
done
(
assert
.
equal
(
css
,
expectedRender
));
...
...
@@ -60,19 +58,19 @@ describe("DEPRECATED: compile scss", function() {
});
});
it
(
"should match compiled string with renderSync"
,
function
(
done
)
{
it
(
'should match compiled string with renderSync'
,
function
(
done
)
{
done
(
assert
.
equal
(
sass
.
renderSync
(
scssStr
),
expectedRender
));
});
it
(
"should throw an exception for bad input"
,
function
(
done
)
{
it
(
'should throw an exception for bad input'
,
function
(
done
)
{
done
(
assert
.
throws
(
function
()
{
sass
.
renderSync
(
badInput
);
}));
});
});
describe
(
"compile scss"
,
function
()
{
it
(
"should compile with render"
,
function
(
done
)
{
describe
(
'compile scss'
,
function
()
{
it
(
'should compile with render'
,
function
(
done
)
{
sass
.
render
({
data
:
scssStr
,
success
:
function
(
css
)
{
...
...
@@ -81,11 +79,11 @@ describe("compile scss", function() {
});
});
it
(
"should compile with renderSync"
,
function
(
done
)
{
it
(
'should compile with renderSync'
,
function
(
done
)
{
done
(
assert
.
ok
(
sass
.
renderSync
({
data
:
scssStr
})));
});
it
(
"should match compiled string with render"
,
function
(
done
)
{
it
(
'should match compiled string with render'
,
function
(
done
)
{
sass
.
render
({
data
:
scssStr
,
success
:
function
(
css
)
{
...
...
@@ -97,7 +95,7 @@ describe("compile scss", function() {
});
});
it
(
"should have a error status of 1 for bad css"
,
function
(
done
)
{
it
(
'should have a error status of 1 for bad css'
,
function
(
done
)
{
sass
.
render
({
data
:
'{zzz}'
,
success
:
function
(
css
)
{
...
...
@@ -110,24 +108,24 @@ describe("compile scss", function() {
});
});
it
(
"should match compiled string with renderSync"
,
function
(
done
)
{
it
(
'should match compiled string with renderSync'
,
function
(
done
)
{
done
(
assert
.
equal
(
sass
.
renderSync
({
data
:
scssStr
}),
expectedRender
));
});
it
(
"should throw an exception for bad input"
,
function
(
done
)
{
it
(
'should throw an exception for bad input'
,
function
(
done
)
{
done
(
assert
.
throws
(
function
()
{
sass
.
renderSync
({
data
:
badInput
});
}));
});
});
describe
(
"compile file with include paths"
,
function
(){
it
(
"should compile with render"
,
function
(
done
)
{
describe
(
'compile file with include paths'
,
function
(){
it
(
'should compile with render'
,
function
(
done
)
{
sass
.
render
({
file
:
path
.
resolve
(
__dirname
,
"include_path.scss"
),
includePaths
:
[
path
.
resolve
(
__dirname
,
"lib"
),
path
.
resolve
(
__dirname
,
"functions"
)],
file
:
path
.
resolve
(
__dirname
,
'include_path.scss'
),
includePaths
:
[
path
.
resolve
(
__dirname
,
'lib'
),
path
.
resolve
(
__dirname
,
'functions'
)],
success
:
function
(
css
)
{
done
(
assert
.
equal
(
css
,
"body {
\
n background: red;
\
n color: #0000fe; }
\
n"
));
done
(
assert
.
equal
(
css
,
'body {
\
n background: red;
\
n color: #0000fe; }
\
n'
));
},
error
:
function
(
error
)
{
done
(
error
);
...
...
@@ -136,13 +134,13 @@ describe("compile file with include paths", function(){
});
});
describe
(
"compile file with image path"
,
function
(){
it
(
"should compile with render"
,
function
(
done
)
{
describe
(
'compile file with image path'
,
function
(){
it
(
'should compile with render'
,
function
(
done
)
{
sass
.
render
({
file
:
path
.
resolve
(
__dirname
,
"image_path.scss"
),
file
:
path
.
resolve
(
__dirname
,
'image_path.scss'
),
imagePath
:
'/path/to/images'
,
success
:
function
(
css
)
{
done
(
assert
.
equal
(
css
,
"body {
\
n background-image: url(
\"
/path/to/images/image.png
\"
); }
\
n"
));
done
(
assert
.
equal
(
css
,
'body {
\
n background-image: url(
\
"/path/to/images/image.png
\
"); }
\
n'
));
},
error
:
function
(
error
)
{
done
(
error
);
...
...
@@ -151,8 +149,8 @@ describe("compile file with image path", function(){
});
});
describe
(
"compile file"
,
function
()
{
it
(
"should compile with render"
,
function
(
done
)
{
describe
(
'compile file'
,
function
()
{
it
(
'should compile with render'
,
function
(
done
)
{
sass
.
render
({
file
:
sampleFilename
,
success
:
function
(
css
)
{
...
...
@@ -164,11 +162,11 @@ describe("compile file", function() {
});
});
it
(
"should compile with renderSync"
,
function
(
done
)
{
it
(
'should compile with renderSync'
,
function
(
done
)
{
done
(
assert
.
ok
(
sass
.
renderSync
({
file
:
sampleFilename
})));
});
it
(
"should match compiled string with render"
,
function
(
done
)
{
it
(
'should match compiled string with render'
,
function
(
done
)
{
sass
.
render
({
file
:
sampleFilename
,
success
:
function
(
css
)
{
...
...
@@ -180,18 +178,18 @@ describe("compile file", function() {
});
});
it
(
"should match compiled string with renderSync"
,
function
(
done
)
{
it
(
'should match compiled string with renderSync'
,
function
(
done
)
{
done
(
assert
.
equal
(
sass
.
renderSync
({
file
:
sampleFilename
}),
expectedRender
));
});
it
(
"should throw an exception for bad input"
,
function
(
done
)
{
it
(
'should throw an exception for bad input'
,
function
(
done
)
{
done
(
assert
.
throws
(
function
()
{
sass
.
renderSync
({
file
:
badSampleFilename
});
}));
});
});
describe
(
"render to file"
,
function
()
{
describe
(
'render to file'
,
function
()
{
var
outFile
=
path
.
resolve
(
__dirname
,
'out.css'
),
filesWritten
;
...
...
@@ -205,7 +203,7 @@ describe("render to file", function() {
afterEach
(
function
()
{
fs
.
writeFile
.
restore
();
});
it
(
"should compile with renderFile"
,
function
(
done
)
{
it
(
'should compile with renderFile'
,
function
(
done
)
{
sass
.
renderFile
({
file
:
sampleFilename
,
outFile
:
outFile
,
...
...
@@ -219,22 +217,22 @@ describe("render to file", function() {
});
});
it
(
"should raise an error for bad input"
,
function
(
done
)
{
it
(
'should raise an error for bad input'
,
function
(
done
)
{
sass
.
renderFile
({
file
:
badSampleFilename
,
outFile
:
outFile
,
success
:
function
()
{
assert
(
false
,
"success() should not be called"
);
assert
(
false
,
'success() should not be called'
);
done
();
},
error
:
function
()
{
assert
(
true
,
"error() called"
);
assert
(
true
,
'error() called'
);
done
();
}
});
});
it
(
"should save the sourceMap to the default file name"
,
function
(
done
)
{
it
(
'should save the sourceMap to the default file name'
,
function
(
done
)
{
sass
.
renderFile
({
file
:
sampleFilename
,
outFile
:
outFile
,
...
...
@@ -254,7 +252,7 @@ describe("render to file", function() {
});
});
it
(
"should save the sourceMap to a specified file name"
,
function
(
done
)
{
it
(
'should save the sourceMap to a specified file name'
,
function
(
done
)
{
var
mapFileName
=
'foo.css.map'
;
sass
.
renderFile
({
file
:
sampleFilename
,
...
...
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