bs-compile-middleware
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -51,14 +51,14 @@ 'use strict'; | ||
if (error) { | ||
return res.end(formatError(error)); | ||
setError(res, error); | ||
return res.end(); | ||
} | ||
var out = void 0; | ||
try { | ||
out = compiler.compile(data, srcPath); | ||
res.setHeader('Content-Type', _mime2.default.lookup(pathname)); | ||
res.write(compiler.compile(data, srcPath)); | ||
} catch (error) { | ||
out = formatError(error); | ||
setError(res, error); | ||
} | ||
res.end(out); | ||
res.end(); | ||
}); | ||
@@ -88,4 +88,9 @@ }, next); | ||
function formatError(error) { | ||
return error.stack; | ||
function setError(res, error) { | ||
res.setHeader('Content-Type', 'text/html'); | ||
res.write(wrapHTMLContent('<output><pre>' + error.stack + '</pre></output>')); | ||
} | ||
function wrapHTMLContent(content) { | ||
return '<!DOCTYPE html><html><body>' + content + '</body><html>'; | ||
} |
{ | ||
"name": "bs-compile-middleware", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"author": "katashin", | ||
@@ -5,0 +5,0 @@ "description": "Compilation middleware for Browsersync", |
@@ -24,2 +24,3 @@ # bs-compile-middleware | ||
browserSync({ | ||
server: true, | ||
middleware: compileMiddleware({ | ||
@@ -26,0 +27,0 @@ srcDir: 'path/to/src', |
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
6531
68
56