1234567891011121314151617181920212223242526272829303132333435363738394041 |
- const fs = require('fs');
- const path = require('path');
- process.env.VUE_APP_VERSION = require('./package.json').version
- const dayjs = require('dayjs')
- const time = dayjs().format('YYYY-M-D HH:mm:ss')
- process.env.VUE_APP_UPDATE_TIME = time
- module.exports = {
- publicPath: process.env.VUE_APP_PUBLIC_PATH,
- lintOnSave: false,
- productionSourceMap: false,
- css: {
- loaderOptions: {
- less: {
- // globalVars: getLessVariables(path.resolve(__dirname, './src/assets/style/globalVars.less'))
- }
- }
- }
- };
- function getLessVariables(file) {
- var themeContent = fs.readFileSync(file, 'utf-8')
- var variables = {}
- themeContent.split('\n').forEach(function(item) {
- if (item.indexOf('//') > -1 || item.indexOf('/*') > -1) {
- return
- }
- var _pair = item.split(':')
- if (_pair.length < 2) return;
- var key = _pair[0].replace('\r', '').replace('@', '')
- if (!key) return;
- var value = _pair[1].replace(';', '').replace('\r', '').replace(/^\s+|\s+$/g, '')
- variables[key] = value
- })
- return variables
- }
|