express-compiless
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -81,3 +81,4 @@ var Path = require('path'), | ||
if (oldETag) { | ||
var etagFragments = [oldETag.replace(/^"|"$/g, '')]; | ||
var oldETagIsWeak = oldETag && /^W\//.test(oldETag), | ||
etagFragments = [oldETag.replace(/^(?:W\/)?"|"$/g, '')]; | ||
if (importedFileNames.length) { | ||
@@ -91,7 +92,7 @@ var importedFileStats = []; | ||
} | ||
var newETag = '"' + etagFragments.join('-') + '-compiless"'; | ||
var newETag = (oldETagIsWeak ? 'W/' : '') + '"' + etagFragments.join('-') + '-compiless"'; | ||
res.setHeader('ETag', newETag); | ||
if (ifNoneMatch && ifNoneMatch.indexOf(newETag) !== -1) { | ||
return res.status(304).end(); | ||
return res.status(304).send(); | ||
} | ||
@@ -98,0 +99,0 @@ } |
{ | ||
"name": "express-compiless", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Express middleware that compiles less files to css on the way out.", | ||
@@ -32,3 +32,3 @@ "main": "lib/compiless.js", | ||
"devDependencies": { | ||
"express": "4.9.5", | ||
"express": "4.10.7", | ||
"mocha": "=1.8.1", | ||
@@ -35,0 +35,0 @@ "request": "=2.11.4", |
@@ -34,2 +34,17 @@ var express = require('express'), | ||
it('should respond with an ETag header and support conditional GET', function (done) { | ||
request(baseUrl + '/simple.less', passError(done, function (response, body) { | ||
expect(response.statusCode, 'to equal', 200); | ||
expect(body, 'to equal', '#foo #bar {\n color: blue;\n}\n'); | ||
expect(response.headers['content-type'], 'to equal', 'text/css; charset=utf-8'); | ||
var etag = response.headers.etag; | ||
expect(etag, 'to match', /^W\/".*-compiless"$/); | ||
request({url: baseUrl + '/simple.less', headers: {'If-None-Match': etag}}, passError(done, function (response, body) { | ||
expect(response.statusCode, 'to equal', 304); | ||
expect(response.headers.etag, 'to equal', etag); | ||
done(); | ||
})); | ||
})); | ||
}); | ||
it('should compile less file with @import to css with .compilessinclude rules first', function (done) { | ||
@@ -36,0 +51,0 @@ request(baseUrl + '/stylesheet.less', passError(done, function (response, body) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16564
18
206
0