Skip to content

Commit

Permalink
dynamic month update, and check output dir before render
Browse files Browse the repository at this point in the history
  • Loading branch information
im6 committed Feb 29, 2020
1 parent 11ab8ba commit a52abc4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const staticFolder =
export const renderOutputFolder = 'dist/views';
export const publicPath = '/assets';
export const iconCdnUrl = '//dkny.oss-cn-hangzhou.aliyuncs.com/1/icons';
export const directImgGrpNum = 2;
export const nonLazyImg = 2;
export const author = 'ZJ Guo';
export const githubUrl = 'https://github.com';
export const gitRepo = `${githubUrl}/im6/javascript-fun`;
Expand All @@ -16,7 +16,7 @@ export const defaultIcon = [
'github4.png',
][0];
export const leftNavText = [
new Date().getFullYear(),
new Date().getFullYear() + (new Date().getMonth() < 11 ? 0 : 1),
'Developer',
'Designer',
'Architect',
Expand Down
8 changes: 4 additions & 4 deletions src/pages/GitPage/index.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';

import AppContainer from '../../components/AppContainer';
import BoxGroup from '../../components/BoxGroup';
import GitBox from '../../components/GitBox';
import BoxGroup from '../../components/BoxGroup';
import AppContainer from '../../components/AppContainer';

import style from './style.less';
import sharedStyle from '../style.less';
import { directImgGrpNum } from '../../config';
import { nonLazyImg } from '../../config';

const GitPage = ({
url,
Expand All @@ -20,7 +20,7 @@ const GitPage = ({
<AppContainer url={url} criticalCss={criticalCss}>
<div className={sharedStyle.main}>
{source.map((v, k) => {
const lazyLoad = k > directImgGrpNum;
const lazyLoad = k > nonLazyImg;
return (
<BoxGroup key={v.id} title={v.name}>
{v.list.map(v1 => (
Expand Down
3 changes: 2 additions & 1 deletion src/render/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
defaultIcon,
pageLink,
renderOutputFolder,
viewModelPath
viewModelPath,
} from '../config';

const gitCssDir = 'dist/public/main.css';
Expand Down Expand Up @@ -55,6 +55,7 @@ const generateSitePage = url => {
};

if (!fs.existsSync(renderOutputFolder)) {
fs.mkdirSync(renderOutputFolder);
fs.mkdirSync(`${renderOutputFolder}/node`);
fs.mkdirSync(`${renderOutputFolder}/library`);
fs.mkdirSync(`${renderOutputFolder}/site`);
Expand Down

0 comments on commit a52abc4

Please sign in to comment.