set explicit comparisions for feature envvars so js can properly optimize
This commit is contained in:
parent
cd2914ca9c
commit
a18f4c3b8d
7 changed files with 17 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { enable, disable, auto } from 'darkreader';
|
import { enable, disable, auto, setFetchMethod } from 'darkreader';
|
||||||
import { darkmode } from "@params";
|
import { darkmode } from "@params";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -7,6 +7,8 @@ const {
|
||||||
fixes,
|
fixes,
|
||||||
} = darkmode.darkreader;
|
} = darkmode.darkreader;
|
||||||
|
|
||||||
|
setFetchMethod(window.fetch)
|
||||||
|
|
||||||
export function setSchemeDark() {
|
export function setSchemeDark() {
|
||||||
enable(theme, fixes);
|
enable(theme, fixes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
const PERSISTENCE_KEY = 'darkmode:color-scheme';
|
const PERSISTENCE_KEY = 'darkmode:color-scheme';
|
||||||
|
|
||||||
async function getService() {
|
async function getService() {
|
||||||
if(process.env.FEATURE_DARKMODE_DARKREADER) {
|
if(process.env.FEATURE_DARKMODE_DARKREADER === '1') {
|
||||||
return await import('./darkreader');
|
return await import('./darkreader');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw Error(' No service defined for feature markMode.');
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', async () => {
|
window.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
if (process.env.FEATURE_FLOWCHART_MERMAID) {
|
if (process.env.FEATURE_FLOWCHART_MERMAID === '1') {
|
||||||
import('./mermaid');
|
import('./mermaid');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
if (process.env.FEATURE_VIDEOPLAYER) {
|
if (process.env.FEATURE_VIDEOPLAYER === '1') {
|
||||||
import('./videoplayer');
|
import('./videoplayer');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.FEATURE_TOC) {
|
if (process.env.FEATURE_TOC === '1') {
|
||||||
import('./toc');
|
import('./toc');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.FEATURE_DARKMODE) {
|
if (process.env.FEATURE_DARKMODE === '1') {
|
||||||
import('./darkmode');
|
import('./darkmode');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.FEATURE_FLOWCHART) {
|
if (process.env.FEATURE_FLOWCHART === '1') {
|
||||||
import('./flowchart');
|
import('./flowchart');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.FEATURE_SYNTAXHIGHLIGHT) {
|
if (process.env.FEATURE_SYNTAXHIGHLIGHT === '1') {
|
||||||
import('./syntaxhighlight');
|
import('./syntaxhighlight');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.FEATURE_MATH) {
|
if (process.env.FEATURE_MATH === '1') {
|
||||||
import('./math');
|
import('./math');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.FEATURE_EMBEDPDF) {
|
if (process.env.FEATURE_EMBEDPDF === '1') {
|
||||||
import('./embedpdf');
|
import('./embedpdf');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
if (process.env.FEATURE_MATH_KATEX) {
|
if (process.env.FEATURE_MATH_KATEX === '1') {
|
||||||
import('./katex');
|
import('./katex');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
if (process.env.FEATURE_SYNTAXHIGHLIGHT_HLJS) {
|
if (process.env.FEATURE_SYNTAXHIGHLIGHT_HLJS === '1') {
|
||||||
import('./hljs');
|
import('./hljs');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
if (process.env.FEATURE_VIDEOPLAYER_PLYR) {
|
if (process.env.FEATURE_VIDEOPLAYER_PLYR === '1') {
|
||||||
import('./plyr');
|
import('./plyr');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue