webpack分块打包优化性能

This commit is contained in:
结发受长生 2019-05-05 22:56:10 +08:00
parent 0724a66403
commit 4117c3b7ff
10 changed files with 82 additions and 100 deletions

View File

@ -79,6 +79,7 @@
font-family: Menlo,Monaco,"Andale Mono","lucida console","Courier New","Microsoft YaHei";
word-wrap: break-word;
font-size: 14px;
border-radius: $radiusSmall;
}
blockquote {
padding: 15px 20px;

View File

@ -694,10 +694,6 @@
-ms-transition: all 0.8s ease-in;
}
%line-bg {
background: linear-gradient(200deg, #a0cfe4, #e8c37e);
}
%paper-bg {
background: url('./img/checkered-pattern.png') repeat #5d5d5d;
}

View File

@ -41,12 +41,6 @@ $colorA: #aaa;
$colorC: #ccc;
$colorF: #f5f5f5;
$blue: #007aff !default;
$orange: #ff9500 !default;
$red: #ff3b30 !default;
$green: #4cd964 !default;
$primary: #007aff !default;
// 元素上下间距
//-----------------------------------------------------
@ -74,11 +68,4 @@ $timingFunction: cubic-bezier(0.42, 0, 0.58, 1);
$activeStateSwitch: true !default;
// z-index
//-----------------------------------------------------
$zIndexHeader: 1000 !default;
$zIndexFooter: 2000 !default;
$zIndexPopup: 3000 !default;
$zIndexOverlay: 4000 !default; // 默认高于header和footer部分
$articlePadding: 7.6923%;

View File

@ -257,9 +257,6 @@ html, body, #container {
.archives-wrap{
margin: 10px 10px 0px;
padding: 10px;
.archive-article-title{
font-size: 16px;
}
.archive-year-wrap{
position: relative;
padding: 0 0 0 0;

View File

@ -3,6 +3,7 @@
*/
$mainBg_night: #1f2e3c; // 主背景色
$articleBg_night: #15202b; // 文章背景色
$borderColor_night: #38444d; // 边框颜色
$textColor_night: #d5d5d5; // 文字颜色
body.night {
@ -18,7 +19,7 @@ body.night {
// 文章区域
.article{
background: $articleBg_night;
border-color: rgb(56, 68, 77);
border-color: $borderColor_night;
color: $textColor_night;
.article-title { // 主标题
color: $colorF;
@ -30,6 +31,17 @@ body.night {
color: #b8a7a7;
}
}
// 归档列表
.archives-wrap {
background: $articleBg_night;
border-bottom-color: $borderColor_night;
.archive-article {
border-color: $borderColor_night;
}
a.archive-article-title {
color: $textColor_night;
}
}
// 左侧栏
.left-col {
background: $articleBg_night;

View File

@ -55,7 +55,7 @@
}
}
.waifu-tool {
color: #aaa;
color: $colorA;
top: 100px;
right: 10px;
font-size: 14px;
@ -90,17 +90,6 @@
}
}
}
/*
body.night .waifu {
color: #34495e;
filter: brightness(30%);
}
*/
@media (max-width: 768px) {
.waifu {
display: none;
}
}
@keyframes shake {
2% {

View File

@ -1,16 +1,16 @@
// const AV = require('leancloud-storage');
window.AV = require('leancloud-storage');
const Valine = require('../lib/Valine.min');
// const Valine = require('../lib/Valine.min');
/**
* Valine.min.js.bak文件, 是根据Valine项目源代码重新打包的
* 使用根据Valine项目源代码重新打包
* 可以支持对于AV对象的传参输入, 而不需要暴露全局变量
* 但是缺少一些新功能
*/
// 评论配置
const commentConfig = require("../config/comment.json");
const commentConfig = require("../config/comment.json")
if(window.yiliaConfig.isPost && commentConfig.valine.enable) {
commentConfig.valine.config.path = window.location.pathname;
// commentConfig.valine.config.av = AV;
new Valine(commentConfig.valine.config);
}
import(/* webpackChunkName: "valine" */ '../lib/Valine.min').then(({ default: Valine }) => {
commentConfig.valine.config.path = window.location.pathname
// commentConfig.valine.config.av = AV;
new Valine(commentConfig.valine.config)
})

View File

@ -14,3 +14,8 @@ Util.addLoadEvent(function() {
// Viewer.init()
Aside.init()
})
const commentConfig = require("../config/comment.json")
if(window.yiliaConfig.isPost && commentConfig.valine.enable) {
// 如果是文章详情页面, 并且启用了评论, 则加载评论相关代码
import(/* webpackChunkName: "comment" */ './comment')
}

File diff suppressed because one or more lines are too long

View File

@ -15,11 +15,12 @@ module.exports = {
main: "./source-src/js/main.js",
slider: "./source-src/js/slider.js",
mobile: ["babel-polyfill", "./source-src/js/mobile.js"],
comment: "./source-src/js/comment.js",
// comment: "./source-src/js/comment.js",
viewer: "./source-src/js/viewer.js",
waifu: "./source-src/js/waifu.js"
},
output: {
publicPath: '/',
path: __dirname+"/source",
filename: "js/[name].[chunkhash:8].js"
},