Compare commits
9
Commits
c1cbb45b34
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4e47fe9fa
|
||
|
|
a4ce7274cd
|
||
|
|
a2d1b2cc49
|
||
|
|
173e870a73
|
||
|
|
6c8ac211ae
|
||
|
|
fb1cbbada4
|
||
|
|
6f6fcebd18
|
||
|
|
7d827d5db8
|
||
|
|
183aa7627b
|
@@ -1,7 +1,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
db.json
|
db.json
|
||||||
package-lock.json
|
|
||||||
*.log
|
*.log
|
||||||
node_modules/
|
node_modules/
|
||||||
public/
|
public/
|
||||||
|
|||||||
+4
-5
@@ -1,14 +1,12 @@
|
|||||||
const gulp = require('gulp'),
|
const gulp = require('gulp'),
|
||||||
htmlmin = require('gulp-htmlmin'), // html压缩组件
|
htmlmin = require('gulp-html-minifier-terser'), // html压缩组件
|
||||||
htmlclean = require('gulp-htmlclean'), // html清理组件
|
htmlclean = require('gulp-htmlclean'), // html清理组件
|
||||||
plumber = require('gulp-plumber'), // 容错组件(发生错误不跳出任务,并报出错误内容)
|
plumber = require('gulp-plumber'), // 容错组件(发生错误不跳出任务,并报出错误内容)
|
||||||
Hexo = require('hexo'),
|
Hexo = require('hexo'),
|
||||||
log = require('fancy-log') // gulp的日志输出
|
log = require('fancy-log') // gulp的日志输出
|
||||||
|
|
||||||
// 程序执行的传参
|
// 程序执行的传参
|
||||||
const argv = require('optimist')
|
const argv = require('minimist')(process.argv.slice(2))
|
||||||
.describe('deployPath', '静态化后发布的目录')
|
|
||||||
.argv
|
|
||||||
|
|
||||||
const hexo = new Hexo(process.cwd(), {})
|
const hexo = new Hexo(process.cwd(), {})
|
||||||
|
|
||||||
@@ -20,7 +18,8 @@ gulp.task('generate', async function() {
|
|||||||
await hexo.call('generate', { watch: false })
|
await hexo.call('generate', { watch: false })
|
||||||
return hexo.exit()
|
return hexo.exit()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return hexo.exit(err)
|
await hexo.exit(err)
|
||||||
|
throw err // 让 gulp series 感知到失败并终止后续任务
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Generated
+5543
File diff suppressed because it is too large
Load Diff
+12
-10
@@ -3,33 +3,35 @@
|
|||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"hexo": {
|
"hexo": {
|
||||||
"version": "6.0.0"
|
"version": "8.1.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "hexo server",
|
"dev": "hexo server",
|
||||||
"build": "gulp"
|
"build": "gulp"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hexo": "^6.0.0",
|
"hexo": "^8.1.2",
|
||||||
"hexo-generator-archive": "^1.0.0",
|
"hexo-generator-archive": "^1.0.0",
|
||||||
"hexo-generator-baidu-sitemap": "^0.1.9",
|
|
||||||
"hexo-generator-category": "^1.0.0",
|
"hexo-generator-category": "^1.0.0",
|
||||||
"hexo-generator-feed": "^3.0.0",
|
"hexo-generator-feed": "^3.0.0",
|
||||||
"hexo-generator-index": "^2.0.0",
|
"hexo-generator-index": "^2.0.0",
|
||||||
"hexo-generator-json-content": "^4.2.3",
|
"hexo-generator-json-content": "^4.2.3",
|
||||||
"hexo-generator-sitemap": "^2.2.0",
|
"hexo-generator-sitemap": "^3.0.1",
|
||||||
"hexo-generator-tag": "^1.0.0",
|
"hexo-generator-tag": "^1.0.0",
|
||||||
"hexo-renderer-ejs": "^2.0.0",
|
"hexo-renderer-ejs": "^2.0.0",
|
||||||
"hexo-renderer-marked": "^5.0.0",
|
"hexo-renderer-marked": "^7.0.1",
|
||||||
"hexo-server": "^3.0.0",
|
"hexo-server": "^3.0.0",
|
||||||
"hexo-wordcount": "^6.0.1"
|
"hexo-wordcount": "^6.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^4.0.2",
|
"gulp": "^5.0.1",
|
||||||
"gulp-htmlclean": "^2.7.22",
|
"gulp-htmlclean": "^2.7.22",
|
||||||
"gulp-htmlmin": "^5.0.1",
|
"gulp-html-minifier-terser": "^7.1.0",
|
||||||
"gulp-plumber": "^1.2.1",
|
"gulp-plumber": "^1.2.1",
|
||||||
"nunjucks": "^3.2.3",
|
"minimist": "^1.2.8",
|
||||||
"optimist": "^0.6.1"
|
"nunjucks": "^3.2.3"
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"ejs": "^6.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,16 @@ const nunjucks = require('nunjucks')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
|
||||||
|
// hexo@8 移除了内置 jsfiddle tag,在此重新注册
|
||||||
|
hexo.extend.tag.register('jsfiddle', function(args) {
|
||||||
|
const shortcode = args[0]
|
||||||
|
const tabs = args[1] || 'js,resources,html,css,result'
|
||||||
|
const skin = args[2] || 'light'
|
||||||
|
const width = args[3] || '100%'
|
||||||
|
const height = args[4] || '300'
|
||||||
|
return `<iframe style="width: ${width}; height: ${height}px" src="//jsfiddle.net/${shortcode}/embedded/${tabs}/?skin=${skin}" allowfullscreen="allowfullscreen" frameborder="0"></iframe>`
|
||||||
|
})
|
||||||
|
|
||||||
const env = new nunjucks.configure({ autoescape: false })
|
const env = new nunjucks.configure({ autoescape: false })
|
||||||
env.addFilter('noControlChars', function(str) {
|
env.addFilter('noControlChars', function(str) {
|
||||||
return str && str.replace(/[\x00-\x1F\x7F]/g, '')
|
return str && str.replace(/[\x00-\x1F\x7F]/g, '')
|
||||||
@@ -31,4 +41,41 @@ hexo.extend.generator.register('xml', function(locals){
|
|||||||
path: 'articles.xml',
|
path: 'articles.xml',
|
||||||
data: xmlData
|
data: xmlData
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 自定义 Baidu Sitemap 生成器(替代已废弃的 hexo-generator-baidu-sitemap)
|
||||||
|
hexo.extend.generator.register('baidusitemap', function(locals) {
|
||||||
|
const config = hexo.config.baidusitemap || {}
|
||||||
|
const outputPath = config.path || 'baidusitemap.xml'
|
||||||
|
|
||||||
|
const posts = locals.posts.toArray().filter(function(post) { return !post.draft })
|
||||||
|
const pages = locals.pages.toArray()
|
||||||
|
const allItems = posts.concat(pages).sort(function(a, b) {
|
||||||
|
const dateA = (a.updated || a.date)
|
||||||
|
const dateB = (b.updated || b.date)
|
||||||
|
return dateB - dateA
|
||||||
|
})
|
||||||
|
|
||||||
|
const lines = [
|
||||||
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
||||||
|
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
|
||||||
|
]
|
||||||
|
|
||||||
|
allItems.forEach(function(item) {
|
||||||
|
const dateObj = item.updated || item.date
|
||||||
|
const dateStr = dateObj && dateObj.format
|
||||||
|
? dateObj.format('YYYY-MM-DD')
|
||||||
|
: new Date(dateObj).toISOString().split('T')[0]
|
||||||
|
lines.push(' <url>')
|
||||||
|
lines.push(' <loc>' + item.permalink + '</loc>')
|
||||||
|
lines.push(' <lastmod>' + dateStr + '</lastmod>')
|
||||||
|
lines.push(' </url>')
|
||||||
|
})
|
||||||
|
|
||||||
|
lines.push('</urlset>')
|
||||||
|
|
||||||
|
return {
|
||||||
|
path: outputPath,
|
||||||
|
data: lines.join('\n')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
{
|
{
|
||||||
"presets": [
|
"presets": [
|
||||||
"@babel/preset-env"
|
["@babel/preset-env", {
|
||||||
|
"useBuiltIns": "usage",
|
||||||
|
"corejs": 3
|
||||||
|
}]
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@babel/transform-runtime"
|
"@babel/transform-runtime"
|
||||||
|
|||||||
Generated
+2185
-8110
File diff suppressed because it is too large
Load Diff
+24
-25
@@ -18,39 +18,38 @@
|
|||||||
"author": "litten",
|
"author": "litten",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-polyfill": "^6.23.0",
|
"@babel/runtime": "^7.26.0",
|
||||||
"leancloud-storage": "^3.7.3",
|
"core-js": "^3.40.0",
|
||||||
"photoswipe": "^4.1.3",
|
"photoswipe": "^4.1.3",
|
||||||
"qrious": "^4.0.2",
|
"qrious": "^4.0.2",
|
||||||
"scrollreveal": "^4.0.5",
|
"scrollreveal": "^4.0.9",
|
||||||
"vue": "^2.6.14"
|
"vue": "^2.7.16"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.17.5",
|
"@babel/core": "^7.29.7",
|
||||||
"@babel/plugin-transform-runtime": "^7.17.0",
|
"@babel/plugin-transform-runtime": "^7.29.0",
|
||||||
"@babel/preset-env": "^7.16.11",
|
"@babel/preset-env": "^7.29.0",
|
||||||
"autoprefixer": "^10.4.2",
|
"autoprefixer": "^10.4.20",
|
||||||
"axios": "^1.13.6",
|
"babel-loader": "^9.2.1",
|
||||||
"babel-loader": "8.3.0",
|
"css-loader": "^7.1.2",
|
||||||
"clean-webpack-plugin": "^4.0.0",
|
"html-webpack-plugin": "^5.6.3",
|
||||||
"css-loader": "^5.2.7",
|
"less": "^4.2.2",
|
||||||
"file-loader": "^6.2.0",
|
"less-loader": "^12.2.0",
|
||||||
"html-webpack-plugin": "^5.5.0",
|
"mini-css-extract-plugin": "^2.9.2",
|
||||||
"less": "^4.1.3",
|
"postcss": "^8.5.25",
|
||||||
"less-loader": "^11.1.0",
|
"postcss-loader": "^8.1.1",
|
||||||
"mini-css-extract-plugin": "^2.6.0",
|
"terser-webpack-plugin": "^5.3.11",
|
||||||
"postcss-loader": "^6.2.1",
|
"webpack": "^5.97.1",
|
||||||
"terser-webpack-plugin": "^5.3.1",
|
"webpack-cli": "^5.1.4"
|
||||||
"url-loader": "^4.1.1",
|
},
|
||||||
"webpack": "^5.70.0",
|
"overrides": {
|
||||||
"webpack-cli": "^4.9.2"
|
"brace-expansion": "5.0.9"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"> 1%",
|
"> 1%",
|
||||||
"last 2 versions",
|
"last 2 versions",
|
||||||
"not dead",
|
"not dead",
|
||||||
"iOS >= 7",
|
"iOS >= 10",
|
||||||
"Android >= 4",
|
"Android >= 5"
|
||||||
"not ie <= 8"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [
|
plugins: [
|
||||||
"autoprefixer",
|
"autoprefixer"
|
||||||
"postcss-preset-env"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,13 +285,11 @@
|
|||||||
// trans
|
// trans
|
||||||
.trans() {
|
.trans() {
|
||||||
transition: all 0.2s ease-in;
|
transition: all 0.2s ease-in;
|
||||||
-ms-transition: all 0.2s ease-in;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// trans8
|
// trans8
|
||||||
.trans8() {
|
.trans8() {
|
||||||
transition: all 0.8s ease-in;
|
transition: all 0.8s ease-in;
|
||||||
-ms-transition: all 0.8s ease-in;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// display-flex
|
// display-flex
|
||||||
|
|||||||
@@ -12,8 +12,7 @@
|
|||||||
// 1. Prevent mobile text size adjust after orientation change, without disabling user zoom.
|
// 1. Prevent mobile text size adjust after orientation change, without disabling user zoom.
|
||||||
// 2. Remove the gray background color from tap, default value is inherit
|
// 2. Remove the gray background color from tap, default value is inherit
|
||||||
html {
|
html {
|
||||||
-ms-text-size-adjust: 100%; // 1
|
text-size-adjust: 100%; // 1
|
||||||
-webkit-text-size-adjust: 100%; // 1
|
|
||||||
-webkit-tap-highlight-color: transparent; // 2
|
-webkit-tap-highlight-color: transparent; // 2
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
@@ -188,7 +187,7 @@ button,
|
|||||||
html input[type="button"],
|
html input[type="button"],
|
||||||
input[type="reset"],
|
input[type="reset"],
|
||||||
input[type="submit"] {
|
input[type="submit"] {
|
||||||
-webkit-appearance: button; // 1
|
appearance: button; // 1
|
||||||
cursor: pointer; // 2
|
cursor: pointer; // 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,14 +225,14 @@ input[type="number"]::-webkit-outer-spin-button {
|
|||||||
// 1. Address `appearance` set to `searchfield` in Safari and Chrome.
|
// 1. Address `appearance` set to `searchfield` in Safari and Chrome.
|
||||||
// 2. Address `box-sizing` set to `border-box` in Safari and Chrome.
|
// 2. Address `box-sizing` set to `border-box` in Safari and Chrome.
|
||||||
input[type="search"] {
|
input[type="search"] {
|
||||||
-webkit-appearance: textfield; // 1
|
appearance: textfield; // 1
|
||||||
box-sizing: content-box; // 2
|
box-sizing: content-box; // 2
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove inner padding and search cancel button in Safari and Chrome on OS X.
|
// Remove inner padding and search cancel button in Safari and Chrome on OS X.
|
||||||
input[type="search"]::-webkit-search-cancel-button,
|
input[type="search"]::-webkit-search-cancel-button,
|
||||||
input[type="search"]::-webkit-search-decoration {
|
input[type="search"]::-webkit-search-decoration {
|
||||||
-webkit-appearance: none;
|
appearance: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define consistent border, margin, and padding.
|
// Define consistent border, margin, and padding.
|
||||||
|
|||||||
@@ -1,166 +0,0 @@
|
|||||||
@font-face {
|
|
||||||
font-family: "FontAwesome";
|
|
||||||
src: url("./fonts/fontawsome-thin.eot"); /* IE9 */
|
|
||||||
src: url("./fonts/fontawsome-thin.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */
|
|
||||||
url("./fonts/fontawsome-thin.woff") format("woff"), /* chrome、firefox */
|
|
||||||
url("./fonts/fontawsome-thin.ttf") format("truetype"), /* chrome、firefox、opera、Safari, Android, iOS 4.2+ */
|
|
||||||
url("./fonts/fontawsome-thin.svg#uxfonteditor") format("svg"); /* iOS 4.1- */
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
.icon {
|
|
||||||
/* use !important to prevent issues with browser extensions that change fonts */
|
|
||||||
font-family: 'FontAwesome' !important;
|
|
||||||
speak-as: none;
|
|
||||||
font-size:16px;
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: normal;
|
|
||||||
font-variant: normal;
|
|
||||||
text-transform: none;
|
|
||||||
line-height: 1;
|
|
||||||
|
|
||||||
/* Better Font Rendering =========== */
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
.icon-search:before {
|
|
||||||
content: "\f002";
|
|
||||||
}
|
|
||||||
.icon-check:before {
|
|
||||||
content: "\f00c";
|
|
||||||
}
|
|
||||||
.icon-remove:before,
|
|
||||||
.icon-close:before {
|
|
||||||
content: "\f00d";
|
|
||||||
}
|
|
||||||
.icon-home:before {
|
|
||||||
content: "\f015";
|
|
||||||
}
|
|
||||||
.icon-twitter-square:before {
|
|
||||||
content: "\f081";
|
|
||||||
}
|
|
||||||
.icon-iconcebook-square:before {
|
|
||||||
content: "\f082";
|
|
||||||
}
|
|
||||||
.icon-github-square:before {
|
|
||||||
content: "\f092";
|
|
||||||
}
|
|
||||||
.icon-ellipsis-v:before {
|
|
||||||
content: "\f142";
|
|
||||||
}
|
|
||||||
.icon-google-plus-square:before {
|
|
||||||
content: "\f0d4";
|
|
||||||
}
|
|
||||||
.icon-twitter:before {
|
|
||||||
content: "\f099";
|
|
||||||
}
|
|
||||||
.icon-facebook:before {
|
|
||||||
content: "\f09a";
|
|
||||||
}
|
|
||||||
.icon-github:before {
|
|
||||||
content: "\f09b";
|
|
||||||
}
|
|
||||||
.icon-feed:before,
|
|
||||||
.icon-rss:before {
|
|
||||||
content: "\f09e";
|
|
||||||
}
|
|
||||||
.icon-weibo:before {
|
|
||||||
content: "\f18a";
|
|
||||||
}
|
|
||||||
.icon-google-plus:before {
|
|
||||||
content: "\f0d5";
|
|
||||||
}
|
|
||||||
.icon-tag:before {
|
|
||||||
content: "\f02b";
|
|
||||||
}
|
|
||||||
.icon-tags:before {
|
|
||||||
content: "\f02c";
|
|
||||||
}
|
|
||||||
.icon-book:before {
|
|
||||||
content: "\f02d";
|
|
||||||
}
|
|
||||||
.icon-calendar:before {
|
|
||||||
content: "\f073";
|
|
||||||
}
|
|
||||||
.icon-file-text:before {
|
|
||||||
content: "\f15c";
|
|
||||||
}
|
|
||||||
.icon-file-text-o:before {
|
|
||||||
content: "\f0f6";
|
|
||||||
}
|
|
||||||
.icon-clock:before {
|
|
||||||
content: "\f017";
|
|
||||||
}
|
|
||||||
.icon-eye:before {
|
|
||||||
content: "\f06e";
|
|
||||||
}
|
|
||||||
.icon-camera:before {
|
|
||||||
content: "\f030";
|
|
||||||
}
|
|
||||||
.icon-comment:before {
|
|
||||||
content: "\f075";
|
|
||||||
}
|
|
||||||
.icon-comment-o:before {
|
|
||||||
content: "\f0e5";
|
|
||||||
}
|
|
||||||
.icon-info:before {
|
|
||||||
content: "\f129";
|
|
||||||
}
|
|
||||||
.icon-info-circle:before {
|
|
||||||
content: "\f05a";
|
|
||||||
}
|
|
||||||
.icon-qq:before {
|
|
||||||
content: "\f1d6";
|
|
||||||
}
|
|
||||||
.icon-wechat:before,
|
|
||||||
.icon-weixin:before {
|
|
||||||
content: "\f1d7";
|
|
||||||
}
|
|
||||||
.icon-spinner:before {
|
|
||||||
content: "\f110";
|
|
||||||
}
|
|
||||||
.icon-arrow-circle-o-right:before {
|
|
||||||
content: "\f18e";
|
|
||||||
}
|
|
||||||
.icon-arrow-circle-o-left:before {
|
|
||||||
content: "\f190";
|
|
||||||
}
|
|
||||||
.icon-share-alt:before {
|
|
||||||
content: "\f1e0";
|
|
||||||
}
|
|
||||||
.icon-share-alt-square:before {
|
|
||||||
content: "\f1e1";
|
|
||||||
}
|
|
||||||
.icon-list:before {
|
|
||||||
content: "\f03a";
|
|
||||||
}
|
|
||||||
.icon-mail:before {
|
|
||||||
content: "\f0e0";
|
|
||||||
}
|
|
||||||
.icon-mail-o:before {
|
|
||||||
content: "\f003";
|
|
||||||
}
|
|
||||||
.icon-chevron-up:before {
|
|
||||||
content: "\f077";
|
|
||||||
}
|
|
||||||
.icon-thumb-tack:before {
|
|
||||||
content: "\f08d";
|
|
||||||
}
|
|
||||||
.icon-quote-left:before {
|
|
||||||
content: "\f10d";
|
|
||||||
}
|
|
||||||
.icon-quote-right:before {
|
|
||||||
content: "\f10e";
|
|
||||||
}
|
|
||||||
.icon-angle-left:before {
|
|
||||||
content: "\f104";
|
|
||||||
}
|
|
||||||
.icon-github-alt:before {
|
|
||||||
content: "\f113";
|
|
||||||
}
|
|
||||||
.icon-linkedin-square:before {
|
|
||||||
content: "\f08c";
|
|
||||||
}
|
|
||||||
.icon-linkedin:before {
|
|
||||||
content: "\f0e1";
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: "FontAwesome";
|
||||||
|
src: url("./fonts/fontawsome-thin.eot"); /* IE9 */
|
||||||
|
src: url("./fonts/fontawsome-thin.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */
|
||||||
|
url("./fonts/fontawsome-thin.woff") format("woff"), /* chrome、firefox */
|
||||||
|
url("./fonts/fontawsome-thin.ttf") format("truetype"), /* chrome、firefox、opera、Safari, Android, iOS 4.2+ */
|
||||||
|
url("./fonts/fontawsome-thin.svg#uxfonteditor") format("svg"); /* iOS 4.1- */
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
/* use !important to prevent issues with browser extensions that change fonts */
|
||||||
|
font-family: 'FontAwesome';
|
||||||
|
speak: none;
|
||||||
|
font-size:16px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
text-transform: none;
|
||||||
|
line-height: 1;
|
||||||
|
|
||||||
|
/* Better Font Rendering =========== */
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
&.icon-search:before {
|
||||||
|
content: "\f002";
|
||||||
|
}
|
||||||
|
&.icon-check:before {
|
||||||
|
content: "\f00c";
|
||||||
|
}
|
||||||
|
&.icon-remove:before,
|
||||||
|
&.icon-close:before {
|
||||||
|
content: "\f00d";
|
||||||
|
}
|
||||||
|
&.icon-home:before {
|
||||||
|
content: "\f015";
|
||||||
|
}
|
||||||
|
&.icon-twitter-square:before {
|
||||||
|
content: "\f081";
|
||||||
|
}
|
||||||
|
&.icon-iconcebook-square:before {
|
||||||
|
content: "\f082";
|
||||||
|
}
|
||||||
|
&.icon-github-square:before {
|
||||||
|
content: "\f092";
|
||||||
|
}
|
||||||
|
&.icon-ellipsis-v:before {
|
||||||
|
content: "\f142";
|
||||||
|
}
|
||||||
|
&.icon-google-plus-square:before {
|
||||||
|
content: "\f0d4";
|
||||||
|
}
|
||||||
|
&.icon-twitter:before {
|
||||||
|
content: "\f099";
|
||||||
|
}
|
||||||
|
&.icon-facebook:before {
|
||||||
|
content: "\f09a";
|
||||||
|
}
|
||||||
|
&.icon-github:before {
|
||||||
|
content: "\f09b";
|
||||||
|
}
|
||||||
|
&.icon-feed:before,
|
||||||
|
&.icon-rss:before {
|
||||||
|
content: "\f09e";
|
||||||
|
}
|
||||||
|
&.icon-weibo:before {
|
||||||
|
content: "\f18a";
|
||||||
|
}
|
||||||
|
&.icon-google-plus:before {
|
||||||
|
content: "\f0d5";
|
||||||
|
}
|
||||||
|
&.icon-tag:before {
|
||||||
|
content: "\f02b";
|
||||||
|
}
|
||||||
|
&.icon-tags:before {
|
||||||
|
content: "\f02c";
|
||||||
|
}
|
||||||
|
&.icon-book:before {
|
||||||
|
content: "\f02d";
|
||||||
|
}
|
||||||
|
&.icon-calendar:before {
|
||||||
|
content: "\f073";
|
||||||
|
}
|
||||||
|
&.icon-file-text:before {
|
||||||
|
content: "\f15c";
|
||||||
|
}
|
||||||
|
&.icon-file-text-o:before {
|
||||||
|
content: "\f0f6";
|
||||||
|
}
|
||||||
|
&.icon-clock:before {
|
||||||
|
content: "\f017";
|
||||||
|
}
|
||||||
|
&.icon-eye:before {
|
||||||
|
content: "\f06e";
|
||||||
|
}
|
||||||
|
&.icon-camera:before {
|
||||||
|
content: "\f030";
|
||||||
|
}
|
||||||
|
&.icon-comment:before {
|
||||||
|
content: "\f075";
|
||||||
|
}
|
||||||
|
&.icon-comment-o:before {
|
||||||
|
content: "\f0e5";
|
||||||
|
}
|
||||||
|
&.icon-info:before {
|
||||||
|
content: "\f129";
|
||||||
|
}
|
||||||
|
&.icon-info-circle:before {
|
||||||
|
content: "\f05a";
|
||||||
|
}
|
||||||
|
&.icon-qq:before {
|
||||||
|
content: "\f1d6";
|
||||||
|
}
|
||||||
|
&.icon-wechat:before,
|
||||||
|
&.icon-weixin:before {
|
||||||
|
content: "\f1d7";
|
||||||
|
}
|
||||||
|
&.icon-spinner:before {
|
||||||
|
content: "\f110";
|
||||||
|
}
|
||||||
|
&.icon-arrow-circle-o-right:before {
|
||||||
|
content: "\f18e";
|
||||||
|
}
|
||||||
|
&.icon-arrow-circle-o-left:before {
|
||||||
|
content: "\f190";
|
||||||
|
}
|
||||||
|
&.icon-share-alt:before {
|
||||||
|
content: "\f1e0";
|
||||||
|
}
|
||||||
|
&.icon-share-alt-square:before {
|
||||||
|
content: "\f1e1";
|
||||||
|
}
|
||||||
|
&.icon-list:before {
|
||||||
|
content: "\f03a";
|
||||||
|
}
|
||||||
|
&.icon-mail:before {
|
||||||
|
content: "\f0e0";
|
||||||
|
}
|
||||||
|
&.icon-mail-o:before {
|
||||||
|
content: "\f003";
|
||||||
|
}
|
||||||
|
&.icon-chevron-up:before {
|
||||||
|
content: "\f077";
|
||||||
|
}
|
||||||
|
&.icon-thumb-tack:before {
|
||||||
|
content: "\f08d";
|
||||||
|
}
|
||||||
|
&.icon-quote-left:before {
|
||||||
|
content: "\f10d";
|
||||||
|
}
|
||||||
|
&.icon-quote-right:before {
|
||||||
|
content: "\f10e";
|
||||||
|
}
|
||||||
|
&.icon-angle-left:before {
|
||||||
|
content: "\f104";
|
||||||
|
}
|
||||||
|
&.icon-github-alt:before {
|
||||||
|
content: "\f113";
|
||||||
|
}
|
||||||
|
&.icon-linkedin-square:before {
|
||||||
|
content: "\f08c";
|
||||||
|
}
|
||||||
|
&.icon-linkedin:before {
|
||||||
|
content: "\f0e1";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
@import './_core';
|
@import './_core';
|
||||||
|
@import './font-awsome.less';
|
||||||
@import './grid';
|
@import './grid';
|
||||||
@import './left';
|
@import './left';
|
||||||
@import './scroll';
|
@import './scroll';
|
||||||
|
|||||||
@@ -13,10 +13,8 @@
|
|||||||
a {
|
a {
|
||||||
border: 1px solid @colorBorder;
|
border: 1px solid @colorBorder;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
display: -moz-inline-stack;
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
zoom: 1;
|
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -112,7 +112,6 @@
|
|||||||
bottom: 100%;
|
bottom: 100%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
-webkit-transform: translateX(-50%);
|
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// 样式
|
// 样式
|
||||||
import '../css/main.less'
|
import '../css/main.less'
|
||||||
import '../css/font-awsome.css'
|
|
||||||
// 分享
|
// 分享
|
||||||
import Share from './share'
|
import Share from './share'
|
||||||
// 边缘
|
// 边缘
|
||||||
|
|||||||
@@ -1,25 +1,52 @@
|
|||||||
import axios from 'axios'
|
const DEFAULT_TIMEOUT = 10000
|
||||||
|
|
||||||
const http = axios.create({
|
function serializeParams(params) {
|
||||||
timeout: 10000,
|
if (!params) return ''
|
||||||
paramsSerializer: {
|
const query = Object.entries(params)
|
||||||
indexes: null
|
.filter(([, v]) => v !== undefined && v !== null)
|
||||||
}
|
.flatMap(([k, v]) => Array.isArray(v) ? v.map(item => `${encodeURIComponent(k)}=${encodeURIComponent(item)}`) : [`${encodeURIComponent(k)}=${encodeURIComponent(v)}`])
|
||||||
})
|
.join('&')
|
||||||
|
return query ? '?' + query : ''
|
||||||
|
}
|
||||||
|
|
||||||
http.interceptors.response.use(res => {
|
function handleResponse(res) {
|
||||||
const responseBody = res.data
|
if (!res.ok) {
|
||||||
// 统一响应格式处理
|
return Promise.reject(new Error(`HTTP ${res.status}`))
|
||||||
switch (responseBody.code) {
|
|
||||||
case 0:
|
|
||||||
// 成功,直接返回数据
|
|
||||||
return responseBody.data
|
|
||||||
case -1:
|
|
||||||
return Promise.reject(new Error(responseBody.message || '请求失败'))
|
|
||||||
default:
|
|
||||||
// 其他情况,兼容没有包装格式的响应
|
|
||||||
return res.data
|
|
||||||
}
|
}
|
||||||
}, err => Promise.reject(err))
|
return res.json().then(responseBody => {
|
||||||
|
// 统一响应格式处理
|
||||||
|
switch (responseBody.code) {
|
||||||
|
case 0:
|
||||||
|
// 成功,直接返回数据
|
||||||
|
return responseBody.data
|
||||||
|
case -1:
|
||||||
|
return Promise.reject(new Error(responseBody.message || '请求失败'))
|
||||||
|
default:
|
||||||
|
// 其他情况,兼容没有包装格式的响应
|
||||||
|
return responseBody
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function request(url, options = {}) {
|
||||||
|
const controller = new AbortController()
|
||||||
|
const timer = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT)
|
||||||
|
return fetch(url, { ...options, signal: controller.signal })
|
||||||
|
.then(res => { clearTimeout(timer); return handleResponse(res) })
|
||||||
|
.catch(err => { clearTimeout(timer); return Promise.reject(err) })
|
||||||
|
}
|
||||||
|
|
||||||
|
const http = {
|
||||||
|
get(url, { params } = {}) {
|
||||||
|
return request(url + serializeParams(params))
|
||||||
|
},
|
||||||
|
post(url, data) {
|
||||||
|
return request(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify(data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default http
|
export default http
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
const TerserPlugin = require('terser-webpack-plugin')
|
const TerserPlugin = require('terser-webpack-plugin')
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
|
||||||
|
|
||||||
|
|
||||||
const htmlPluginConfig = {
|
const htmlPluginConfig = {
|
||||||
@@ -24,7 +23,7 @@ module.exports = function(env, argv) {
|
|||||||
})]
|
})]
|
||||||
},
|
},
|
||||||
entry: {
|
entry: {
|
||||||
main: ['babel-polyfill', './source-src/js/main.js'],
|
main: './source-src/js/main.js',
|
||||||
slider: './source-src/js/slider.js',
|
slider: './source-src/js/slider.js',
|
||||||
mobile: './source-src/js/mobile.js',
|
mobile: './source-src/js/mobile.js',
|
||||||
viewer: './source-src/js/viewer.js'
|
viewer: './source-src/js/viewer.js'
|
||||||
@@ -32,44 +31,31 @@ module.exports = function(env, argv) {
|
|||||||
output: {
|
output: {
|
||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
path: __dirname + '/source',
|
path: __dirname + '/source',
|
||||||
filename: isProd ? 'js/[name].[chunkhash].js' : 'js/[name].js'
|
filename: isProd ? 'js/[name].[chunkhash].js' : 'js/[name].js',
|
||||||
|
clean: isProd ? { keep: (asset) => !/^(js|css|fonts|images)\//.test(asset) } : false
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [{
|
rules: [{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
use: {
|
use: 'babel-loader',
|
||||||
loader: 'babel-loader',
|
|
||||||
options: {
|
|
||||||
presets: ['@babel/preset-env'],
|
|
||||||
plugins: ['@babel/plugin-proposal-class-properties'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
exclude: /node_modules/
|
exclude: /node_modules/
|
||||||
},{
|
},{
|
||||||
test: /\.less$/,
|
test: /\.less$/,
|
||||||
use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader']
|
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'less-loader']
|
||||||
},{
|
},{
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
use: [MiniCssExtractPlugin.loader, 'css-loader']
|
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader']
|
||||||
},{
|
},{
|
||||||
test: /\.(png|jpe?g|gif|ico)$/,
|
test: /\.(png|jpe?g|gif|ico)$/,
|
||||||
use: {
|
type: 'asset/resource',
|
||||||
loader: 'file-loader',
|
generator: {
|
||||||
options: {
|
filename: 'images/[name].[contenthash:6][ext]'
|
||||||
name: '[name].[contenthash:6].[ext]',
|
|
||||||
outputPath: 'images',
|
|
||||||
esModule: false // 不使用es6的模块语法
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
test: /\.(svg|eot|ttf|woff2?|otf)$/,
|
test: /\.(svg|eot|ttf|woff2?|otf)$/,
|
||||||
use: {
|
type: 'asset/resource',
|
||||||
loader: 'file-loader',
|
generator: {
|
||||||
options: {
|
filename: 'fonts/[name].[contenthash:6][ext]'
|
||||||
name: '[name].[contenthash:6].[ext]',
|
|
||||||
outputPath: 'fonts',
|
|
||||||
esModule: false // 不使用es6的模块语法
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -83,11 +69,6 @@ module.exports = function(env, argv) {
|
|||||||
template: './source-src/template/css.html',
|
template: './source-src/template/css.html',
|
||||||
filename: '../layout/_partial/css.ejs'
|
filename: '../layout/_partial/css.ejs'
|
||||||
}, htmlPluginConfig)),
|
}, htmlPluginConfig)),
|
||||||
new CleanWebpackPlugin({
|
|
||||||
cleanOnceBeforeBuildPatterns: ['js/*','css/*','fonts/*','images/*'],
|
|
||||||
verbose: true,
|
|
||||||
dry: false,
|
|
||||||
}),
|
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: 'css/[name].[contenthash:6].css'
|
filename: 'css/[name].[contenthash:6].css'
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user