Skip to content

Commit a52abc4

Browse files
committed
dynamic month update, and check output dir before render
1 parent 11ab8ba commit a52abc4

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const staticFolder =
44
export const renderOutputFolder = 'dist/views';
55
export const publicPath = '/assets';
66
export const iconCdnUrl = '//dkny.oss-cn-hangzhou.aliyuncs.com/1/icons';
7-
export const directImgGrpNum = 2;
7+
export const nonLazyImg = 2;
88
export const author = 'ZJ Guo';
99
export const githubUrl = 'https://github.com';
1010
export const gitRepo = `${githubUrl}/im6/javascript-fun`;
@@ -16,7 +16,7 @@ export const defaultIcon = [
1616
'github4.png',
1717
][0];
1818
export const leftNavText = [
19-
new Date().getFullYear(),
19+
new Date().getFullYear() + (new Date().getMonth() < 11 ? 0 : 1),
2020
'Developer',
2121
'Designer',
2222
'Architect',

src/pages/GitPage/index.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33

4-
import AppContainer from '../../components/AppContainer';
5-
import BoxGroup from '../../components/BoxGroup';
64
import GitBox from '../../components/GitBox';
5+
import BoxGroup from '../../components/BoxGroup';
6+
import AppContainer from '../../components/AppContainer';
77

88
import style from './style.less';
99
import sharedStyle from '../style.less';
10-
import { directImgGrpNum } from '../../config';
10+
import { nonLazyImg } from '../../config';
1111

1212
const GitPage = ({
1313
url,
@@ -20,7 +20,7 @@ const GitPage = ({
2020
<AppContainer url={url} criticalCss={criticalCss}>
2121
<div className={sharedStyle.main}>
2222
{source.map((v, k) => {
23-
const lazyLoad = k > directImgGrpNum;
23+
const lazyLoad = k > nonLazyImg;
2424
return (
2525
<BoxGroup key={v.id} title={v.name}>
2626
{v.list.map(v1 => (

src/render/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
defaultIcon,
1212
pageLink,
1313
renderOutputFolder,
14-
viewModelPath
14+
viewModelPath,
1515
} from '../config';
1616

1717
const gitCssDir = 'dist/public/main.css';
@@ -55,6 +55,7 @@ const generateSitePage = url => {
5555
};
5656

5757
if (!fs.existsSync(renderOutputFolder)) {
58+
fs.mkdirSync(renderOutputFolder);
5859
fs.mkdirSync(`${renderOutputFolder}/node`);
5960
fs.mkdirSync(`${renderOutputFolder}/library`);
6061
fs.mkdirSync(`${renderOutputFolder}/site`);

0 commit comments

Comments
 (0)