Dcat-Admin 主题色变更的避坑方法

Laravel

本文最后更新于 <span id="expire-date"></span> 天前,文中部分描述可能已经过时。

官方文档里写了如何变变更主题色,文档如下:

https://learnku.com/docs/dcat-admin/2.x/theme-and-color/8085#db3725

当我们使用 homestead 开发时,运行 php artisan admin:minify orange --color fbbd08 --publish 会报错,问题大约就是在 windows 上运行的 homestead 这样的 linux 系统,在建立软连接的时候会出错,故我这里改一下教程,按照这样的方式就可以编译通过,达到效果

1. Windows 上的操作

上官网下载 Node.js 并安装,找到项目文件所在位置,这里我按照默认的规范,位置在 C:\Users\djsyw\code\MyProject ,之后我们继续寻找 dcat 的包,在 C:\Users\djsyw\code\MyProject\vendor\dcat\laravel-admin 这里,我们在这里打开 Terminal 输入指令

1
npm install

完成后执行

1
npm run dev

相对于在 homestead 里运行 linux Mix 前端工作流那繁琐操蛋的流程, win下就很舒心,至此准备工作结束,我们这些操作完成了在 homestead 上各种报错的环节,这里算是给他提前做好了

2. homestead 上的操作

定位到我们的项目根目录,直接按照教程走,执行命令:

1
php artisan admin:minify orange --color fbbd08 --publish

然后会有接下来的显示,这就没问题了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
➜  yanji git:(master) php artisan admin:minify cecBlue --color 004ea2 --publish
[cecBlue][#004ea2] npm run production...

> prod
> npm run production



> production
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

//这里有很多的 warning 忽略即可(反正没 ERR 就行)

DONE Compiled successfully in 27702ms2:32:20 AM

Asset Size Chunks Chunk Names
/resources/dist/adminlte/adminlte.js 29.4 KiB 0 [emitted] /resources/dist/adminlte/adminlte
/resources/dist/adminlte/adminlte.js.map 83.9 KiB 0 [emitted] [dev] /resources/dist/adminlte/adminlte
/resources/dist/dcat/css/nunito.css 9.83 KiB [emitted]
/resources/dist/dcat/extra/action.js 2.85 KiB 1 [emitted] /resources/dist/dcat/extra/action
/resources/dist/dcat/extra/action.js.map 10.6 KiB 1 [emitted] [dev] /resources/dist/dcat/extra/action
/resources/dist/dcat/extra/grid-extend.js 7.65 KiB 2 [emitted] /resources/dist/dcat/extra/grid-extend
/resources/dist/dcat/extra/grid-extend.js.map 24.7 KiB 2 [emitted] [dev] /resources/dist/dcat/extra/grid-extend
/resources/dist/dcat/extra/select-table.js 4.79 KiB 3 [emitted] /resources/dist/dcat/extra/select-table
/resources/dist/dcat/extra/select-table.js.map 18.3 KiB 3 [emitted] [dev] /resources/dist/dcat/extra/select-table
/resources/dist/dcat/extra/upload.js 24.9 KiB 4 [emitted] /resources/dist/dcat/extra/upload
/resources/dist/dcat/extra/upload.js.map 74.5 KiB 4 [emitted] [dev] /resources/dist/dcat/extra/upload
/resources/dist/dcat/js/dcat-app.js 99.1 KiB 5 [emitted] /resources/dist/dcat/js/dcat-app
/resources/dist/dcat/js/dcat-app.js.map 192 KiB 5 [emitted] [dev] /resources/dist/dcat/js/dcat-app
resources/dist/adminlte/adminlte-cecBlue.css 656 KiB 0 [emitted] [big] /resources/dist/adminlte/adminlte
resources/dist/dcat/css/dcat-app-cecBlue.css 68 KiB 0 [emitted] /resources/dist/adminlte/adminlte
resources/dist/dcat/extra/markdown.css 1.72 KiB 0 [emitted] /resources/dist/adminlte/adminlte
resources/dist/dcat/extra/upload.css 6.34 KiB 0 [emitted] /resources/dist/adminlte/adminlte

Copied Directory [/vendor/dcat/laravel-admin/resources/dist] To [/public/vendor/dcat-admin]
Publishing complete.

之后按照教程就可以了

本文作者:NightingaleWK

本文链接: https://www.wkarrow.top/DcatAdminThemeChange.html