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

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: [
......
This diff is collapsed.
......@@ -6077,6 +6077,13 @@ strip-json-comments@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
style-loader@^0.19.1:
version "0.19.1"
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.19.1.tgz#591ffc80bcefe268b77c5d9ebc0505d772619f85"
dependencies:
loader-utils "^1.0.2"
schema-utils "^0.3.0"
supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
......
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