Commit bc44b2dc authored by Robert Knight's avatar Robert Knight

Fix KaTeX font URL paths

The vendor KaTeX CSS file looks for font URLs in the 'fonts/' directory
relative to the location of katex.min.css.

Rewrite these URLs so that they are fetched from '/assets/fonts' instead
of '/assets/styles/fonts'

Note that the CSS references both WOFF and WOFF 2 format fonts but We
only include the .woff version.
parent 7179ee19
......@@ -15,6 +15,7 @@ var gulp = require('gulp');
var gulpIf = require('gulp-if');
var gulpUtil = require('gulp-util');
var postcss = require('gulp-postcss');
var postcssURL = require('postcss-url');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var through = require('through2');
......@@ -171,15 +172,25 @@ var styleFiles = [
];
gulp.task('build-css', function () {
// Rewrite font URLs to look for fonts in 'build/fonts' instead of
// 'build/styles/fonts'
function rewriteCSSURL(url) {
return url.replace(/^fonts\//, '../fonts/');
}
var sassOpts = {
outputStyle: IS_PRODUCTION_BUILD ? 'compressed' : 'nested',
includePaths: ['node_modules/compass-mixins/lib/'],
};
var cssURLRewriter = postcssURL({
url: rewriteCSSURL,
});
return gulp.src(styleFiles)
.pipe(sourcemaps.init())
.pipe(gulpIf(isSASSFile, sass(sassOpts).on('error', sass.logError)))
.pipe(postcss([require('autoprefixer')]))
.pipe(postcss([require('autoprefixer'), cssURLRewriter]))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(STYLE_DIR));
});
......
......@@ -51,6 +51,7 @@
"ng-tags-input": "2.2.0",
"node-uuid": "^1.4.3",
"postcss": "^5.0.6",
"postcss-url": "^5.1.1",
"query-string": "^3.0.1",
"raf": "^3.1.0",
"raven-js": "^2.0.2",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment