Skip to content

Commit

Permalink
Updates Terraform, adds SCSS helper and test
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethormandy committed Dec 17, 2013
1 parent 2e22b2e commit 88b0139
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports.mimeType = function(source){

if(['.jade', '.md', '.ejs'].indexOf(ext) !== -1){
return mime.lookup('html')
}else if(['.less', '.styl'].indexOf(ext) !== -1){
}else if(['.less', '.styl', '.scss'].indexOf(ext) !== -1){
return mime.lookup('css')
}else{
return mime.lookup(source)
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ exports.compile = function(projectPath, outputPath, callback){
*/
var copyFile = function(file, done){
var ext = path.extname(file)
if(!polymer.helpers.shouldIgnore(file) && [".jade", ".ejs", ".md", ".styl", ".less", ".coffee"].indexOf(ext) === -1){
if(!polymer.helpers.shouldIgnore(file) && [".jade", ".ejs", ".md", ".styl", ".less", ".scss", ".coffee"].indexOf(ext) === -1){
var localPath = path.resolve(outputPath, file)
fs.mkdirp(path.dirname(localPath), function(err){
fs.copy(path.resolve(setup.publicPath, file), localPath, done)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"main": "./lib/index.js",
"repository" : { "type" : "git", "url" : "https://github.com/sintaxi/harp.git" },
"dependencies":{
"terraform": "0.6.1",
"terraform": "0.6.2",
"commander": "2.0.0",
"connect": "2.9.0",
"fs-extra": "0.6.4",
Expand Down
27 changes: 27 additions & 0 deletions test/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ describe("headers", function(){
})
})

it("should be correct with a valid SCSS file", function(done){
superagent.agent().get("http://localhost:" + port + "/valid-scss.css").end(function(err, rsp){
rsp.should.have.status(200)
rsp.headers.should.have.property("content-type", "text/css; charset=UTF-8")
rsp.headers.should.have.property("content-length")
done()
})
})

// invalid

it("should be correct with an invalid EJS file", function(done){
Expand Down Expand Up @@ -136,6 +145,15 @@ describe("headers", function(){
})
})

it("should be correct with an invalid SCSS file", function(done){
superagent.agent().get("http://localhost:" + port + "/invalid-scss.css").end(function(err, rsp){
rsp.should.have.status(200)
rsp.headers.should.have.property("content-type", "text/css; charset=UTF-8")
rsp.headers.should.have.property("content-length")
done()
})
})

// TODO: This should change to javascript error file.
it("should be correct with an invalid CoffeeScript file", function(done){
superagent.agent().get("http://localhost:" + port + "/invalid-coffee.js").end(function(err, rsp){
Expand Down Expand Up @@ -202,6 +220,15 @@ describe("headers", function(){
})
})

it("should be correct when SCSS file requested", function(done){
superagent.agent().get("http://localhost:" + port + "/valid-scss.scss").end(function(err, rsp){
rsp.should.have.status(404)
rsp.headers.should.have.property("content-type", "text/html; charset=UTF-8")
rsp.headers.should.have.property("content-length")
done()
})
})

// missing pages

it("should be correct when missing css file", function(done){
Expand Down

0 comments on commit 88b0139

Please sign in to comment.