/lin-cms-vvlog

增加了CMS博客的用户UI端

Primary LanguageVueMIT LicenseMIT

简介 | 快速上手 | 版本日志

简介

开源

线上 Demo

线上文档地址(完善中)

Lin CMS 是一个前后端分离的 CMS 解决方案

快速上手

# clone the project
git clone https://github.com/luoyunchong/lin-cms-vvlog

# install dependency
npm install or yarn (install)

# develop
npm run serve or yarn (run) serve

#upgrade package
yarn upgrade element-ui
yarn upgrade element-ui@2.13.0

性能优化

  • 1.gzip压缩
npm install compression-webpack-plugin -D

修改vue.config.js

const CompressionPlugin = require('compression-webpack-plugin');//引入gzip压缩插
configureWebpack: config => {
    const baseConfig = {
        name: name,
        resolve: {
            alias: {
                '@': resolve('src')
            }
        }
    }
    if (process.env.NODE_ENV === 'production') {
        return {
            plugins: [
                // 压缩代码
                new CompressionPlugin({
                    test: /\.js$|\.html$|.\css/, // 匹配文件名
                    threshold: 10240, // 对超过10k的数据压缩
                    deleteOriginalAssets: false // true 不删除源文件 false 删除源文件
                })
            ],
            ...baseConfig
        }
    } else {
        return { ...baseConfig }
    }
}
  • 去除console.log与警告
npm install compression-webpack-plugin -D
const TerserPlugin = require('terser-webpack-plugin')
configureWebpack: config => {
    const baseConfig = {
        name: name,
        resolve: {
            alias: {
                '@': resolve('src')
            }
        }
    }
    if (process.env.NODE_ENV === 'production') {
        return {
            plugins: [
                // 压缩代码
                new CompressionPlugin({
                    test: /\.js$|\.html$|.\css/, // 匹配文件名
                    threshold: 10240, // 对超过10k的数据压缩
                    deleteOriginalAssets: false // 不删除源文件
                }),
                // 去除console.log
                new TerserPlugin({
                    terserOptions: {
                        compress: {
                            warnings: false,
                            drop_console: true,
                            drop_debugger: true,
                            pure_funcs: ['console.log']
                        }
                    }
                })
            ],
            ...baseConfig
        }
    } else {
        return { ...baseConfig }
    }
}

版本日志