Commit 2f0335e1 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas
Browse files

Removed the remains of katex from vendor assets and load everything via webpack

parent ad9e3dfe
// import katex from 'katex';
// import katexCSS from 'katex/dist/katex.css';
import Flash from './flash';
// Renders math using KaTeX in any element with the
......@@ -28,16 +29,13 @@ function renderWithKaTeX(elements, katex) {
export default function renderMath($els) {
if (!$els.length) return;
import(/* webpackChunkName: 'katex' */ 'katex').then((katex) => {
$.get(gon.katex_css_url, () => {
const css = $('<link>', {
rel: 'stylesheet',
type: 'text/css',
href: gon.katex_css_url,
});
css.appendTo('head');
import(/* webpackChunkName: 'katex' */ 'katex/dist/katex.css')
.then(() => {
renderWithKaTeX($els, katex);
})
.catch((err) => {
Flash(`Can't load katex css ${err}`);
});
}).catch((err) => {
Flash(`Can't load katex module: ${err}`);
......
......@@ -128,6 +128,29 @@ var config = {
name: '[name].[hash].[ext]',
}
},
{
test: /katex.css$/,
include: /node_modules\/katex\/dist/,
exclude: /(vendor\/assets)/,
use: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
options: {
name: '[name].[hash].[ext]'
}
},
],
},
{
test: /\.(eot|ttf|woff|woff2)$/,
include: /node_modules\/katex\/dist\/fonts/,
exclude: /(vendor\/assets)/,
loader: 'file-loader',
options: {
name: '[name].[hash].[ext]',
}
},
{
test: /monaco-editor\/\w+\/vs\/loader\.js$/,
use: [
......
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