vuejs2 - 从 Pug 模板迁移到 VueJS 的明智方法是什么?
问题描述
我买了一个用 Bootstrap 5 制作的管理模板。在模板中的 Pug 文件中使用了变量和 mixins。例如:
my-vue-project/src/pug/index.pug:
extends layouts/LayoutTheme
include mixins/home/dashboard/Dashboard
prepend scripts
script(src=`${CWD}vendors/echarts/echarts.min.js`)
script(src=`${CWD}vendors/progressbar/progressbar.min.js`)
append variables
- var pageTree = ['dashboard','dashboard','index']
append content
+Dashboard
我不想粉碎用 Pug 编译的 HTML 文件并将它们导入 VueJS。相反,我想使用 Pug 模板,例如<template lang="pug">...</template>
. 但是此时我遇到了两个问题:
- Pug 文件使用
mixins
和其他xxx.pug
文件。 - VueJS 在
my-vue-project/public/index.html
. 但在我的 BS5 模板中,该文件my-vue-project/src/pug/index.pug
是编译gulpfile.js
并启动的。
问题: 您认为将这个 BS5 模板导入到我的 VueJS 项目中最合乎逻辑且最轻松的方式是什么?
目录示例:
.
├── babel.config.js
├── dist
│ ├── css
│ │ └── app.adf3b1b4.css
│ ├── favicon.ico
│ ├── img
│ │ ├── icons
│ │ └── logo.82b9c7a5.png
│ ├── index.html
│ ├── js
│ │ ├── about.674ad911.js
│ │ ├── about.674ad911.js.map
│ │ ├── app.cb56e622.js
│ │ ├── app.cb56e622.js.map
│ │ ├── chunk-vendors.3d365fc9.js
│ │ └── chunk-vendors.3d365fc9.js.map
│ ├── manifest.json
│ ├── precache-manifest.233c12a4d068926cdef1ea853fda8cda.js
│ ├── robots.txt
│ └── service-worker.js
├── node_modules [823 entries exceeds filelimit, not opening dir]
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ ├── img
│ │ └── icons
│ ├── index.html
│ ├── robots.txt
│ └── vendors
│ ├── anchorjs
│ ├── bootstrap
│ ├── chart
│ ├── choices
│ ├── countup
│ ├── dayjs
│ ├── draggable
│ ├── dropzone
│ ├── echarts
│ ├── echarts-countries-js
│ ├── flatpickr
│ ├── fontawesome
│ ├── fullcalendar
│ ├── glightbox
│ ├── is
│ ├── leaflet
│ ├── leaflet.markercluster
│ ├── leaflet.tilelayer.colorfilter
│ ├── list.js
│ ├── lodash
│ ├── lottie
│ ├── overlayscrollbars
│ ├── plyr
│ ├── popper
│ ├── prism
│ ├── progressbar
│ ├── rater-js
│ ├── simplebar
│ ├── swiper
│ ├── tiny-slider
│ ├── tinymce
│ ├── typed.js
│ └── validator
├── src
│ ├── App.vue
│ ├── assets
│ │ └── logo.png
│ ├── components
│ │ └── HelloWorld.vue
│ ├── js [51 entries exceeds filelimit, not opening dir]
│ ├── main.js
│ ├── pug
│ │ ├── app
│ │ ├── changelog.pug
│ │ ├── dashboard
│ │ ├── demo
│ │ ├── documentation
│ │ ├── index.pug
│ │ ├── layouts
│ │ ├── mixins
│ │ ├── modules
│ │ ├── pages
│ │ └── widgets.pug
│ ├── registerServiceWorker.js
│ ├── router
│ │ └── index.js
│ ├── scss
│ │ ├── _bootstrap.scss
│ │ ├── _user-variables.scss
│ │ ├── theme
│ │ ├── theme.scss
│ │ └── user.scss
│ ├── store
│ │ └── index.js
│ └── views
│ ├── About.vue
│ └── Home.vue
└── vue.config.js
解决方案
推荐阅读
- node.js - 使用 nodemailer、pdfkit 和 mailgun 生成动态 pdf 并在 nodejs 中作为电子邮件附件发送
- swift - SwiftUI 代码未在 UIKit 项目中编译
- vue.js - 在 Nuxt 中为每页选择 Vuex 模块
- ios - Xcode 12 模块 'RxSwift' 未在库演化支持下编译;使用它意味着无法保证 '' 的二进制兼容性
- c# - 如何从 C# 中的种子生成器生成随机数,随着时间的推移将继续生成相同的数字?
- c# - CancellationTokenSource 在 TaskCompletionSource 上未按预期工作
- c - 在主函数之外使用 malloc 编译错误
- javascript - 非空数组在选择其元素时返回未定义
- for-loop - Jekyll - 在前面选择带有特定键的页面
- c# - 如何在 mvc 中使用 ajax 成功函数加载数据表 td 值?