From 9eb337bd0ee68222c7ac90958871c8761cb73c72 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sat, 4 Apr 2020 23:45:27 +0800 Subject: [PATCH] docs: fix mourn tree shaking --- docs/site/desktop.js | 4 +++- docs/site/mobile.js | 4 +++- docs/site/mourn.js | 14 ++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/site/desktop.js b/docs/site/desktop.js index 89bc0216c..5e8a53b9c 100644 --- a/docs/site/desktop.js +++ b/docs/site/desktop.js @@ -1 +1,3 @@ -import './mourn'; +import mourn from './mourn'; + +mourn(); diff --git a/docs/site/mobile.js b/docs/site/mobile.js index 63c6222b4..e61ffd3c6 100644 --- a/docs/site/mobile.js +++ b/docs/site/mobile.js @@ -1,4 +1,4 @@ -import './mourn'; +import mourn from './mourn'; import Vue from 'vue'; import Locale from '../../src/locale'; import Lazyload from '../../src/lazyload'; @@ -6,6 +6,8 @@ import { get } from '../../src/utils'; import { camelize } from '../../src/utils/format/string'; import enUS from '../../src/locale/lang/en-US'; +mourn(); + Vue.use(Lazyload, { lazyComponent: true, }); diff --git a/docs/site/mourn.js b/docs/site/mourn.js index 38bb426ec..b171eed55 100644 --- a/docs/site/mourn.js +++ b/docs/site/mourn.js @@ -1,12 +1,18 @@ -const now = new Date(); +export default function () { + const now = new Date(); -if (now.getFullYear() === 2020 && now.getMonth() === 3 && now.getDate() === 4) { - const filter = ` + if ( + now.getFullYear() === 2020 && + now.getMonth() === 3 && + now.getDate() === 4 + ) { + const filter = ` html{ filter: grayscale(100%); -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); } `; - document.head.insertAdjacentHTML('beforeend', ``); + document.head.insertAdjacentHTML('beforeend', ``); + } }