代码拉取完成,页面将自动刷新
const path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
const { spawnSync } = require('child_process');
const findChrome = require('chrome-finder');
const EndWebpackPlugin = require('end-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const outputPath = path.resolve(__dirname, 'docs');
module.exports = {
entry: './src/main.js',
output: {
filename: '[name].js',
path: outputPath
},
module: {
rules: [
{
test: /\.scss$/,
use: ['style-loader', 'css-loader?minimize', 'postcss-loader', 'sass-loader'],
include: path.resolve(__dirname, 'src')
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader?minimize', 'postcss-loader'],
include: path.resolve(__dirname, 'src')
},
{
test: /\.(gif|png|jpe?g|eot|woff|ttf|svg|pdf)$/,
loader: 'base64-inline-loader',
},
]
},
plugins: [
new htmlWebpackPlugin({
filename:'index.html',
template:'./src/index.html',
minify:{//压缩html
collapseWhitespace:true,
removeComments:true
}
}),
new EndWebpackPlugin(async () => {
// 自定义域名
// fs.writeFileSync(path.resolve(outputPath, 'CNAME'), 'https://free.sanmzh.xyz/resume');
// await publishGhPages();
// 调用 Chrome 渲染出 PDF 文件
const chromePath = findChrome();
spawnSync(chromePath, ['--headless', '--disable-gpu', `--print-to-pdf=${path.resolve(outputPath, 'resume.pdf')}`,
'https://sanm-zh.gitee.io/resume/' // 这里注意改成你的在线简历的网站
]);
// 重新发布到 ghpages
// await publishGhPages();
}),
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, 'static'),
to: './static',
ignore: ['.*']
}
])
]
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。