commit befe1c1af7a2ce88a1c7099ee260f05d834d76c6
parent 8c55aed39aad8322e2ac2d8a0da6172818ce36ad
Author: Martin von Gagern <Martin.vGagern@gmx.net>
Date: Tue, 12 Jul 2016 21:23:28 +0200
Upgrade less to version 2 (#503)
This fixes a problem where the graceful-js dependency of the old less
version is incompatible with node 7, and will cause warnings on node 6.
The resulting katex.min.css is exactly the same as with the previous
version, so the major version upgrade does not seem to affect the outcome.
The less.Parser has been deprecated, and less.render is the supported
approach now, so we have to switch the development server to that.
Diffstat:
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/package.json b/package.json
@@ -24,7 +24,7 @@
"jasmine-core": "^2.3.4",
"js-yaml": "^3.3.1",
"jspngopt": "^0.1.0",
- "less": "~1.7.5",
+ "less": "~2.7.1",
"nomnom": "^1.8.1",
"pako": "0.2.7",
"selenium-webdriver": "^2.46.1",
diff --git a/server.js b/server.js
@@ -61,19 +61,18 @@ app.get("/katex.css", function(req, res, next) {
return;
}
- var parser = new less.Parser({
+ less.render(data, {
paths: ["./static"],
filename: "katex.less",
- });
-
- parser.parse(data, function(err, tree) {
+ }, function(err, output) {
if (err) {
+ console.error(String(err));
next(err);
return;
}
res.setHeader("Content-Type", "text/css");
- res.send(tree.toCSS());
+ res.send(output.css);
});
});
});