易栈网-膘叔

发文热力图 2025-12-07 ~ 2026-12-06
少 多 近 365 天共 27 篇
浏览模式: 标准 | 列表 | 图文
解决livewire/livewire.js找不到的问题

解决livewire/livewire.js找不到的问题

因为今天用了filamentPHP这个框架,类似 laravel-admin/ dcat-admin等。为什么想用它呢。看官网,插件极其多...

根据官方的教程进行composer require以及publish素材后,本地一切正常,但上线后,报livewire/livewire.js找不到
找了一下根目录,发现确实没有。于是php artisan route:list|grep livewire,看到是由PHP进行模拟的。
但因为我用的是lnmp ,默认对JS有一个30d的缓存,所以需要在js的判断前加上
location = /livewire/livewire.js {
expires off;
try_files $uri $uri/ /index.php?$query_string;
}:
不设置过期时间 ,同时是由PHP来解析。reload一下nginx,再次打开网页,一切正常
字体转换相关

字体转换相关

小程序里最烦人的就是自定义字体了。设计师们总喜欢用一些看起来很好看的字体。但对于小程序来说简直是个灾难。

所幸,如果是英文字体的话,一般都只有8~10K,但那些 OTF 其实还是很大,而且不少字体中有一些特殊的符号,比如@这些。但事实上很多时候我们都不需要。所以这时候就要转换一下。。。
1、convert OTF to TTF
2、用 sfnttools.jar 包(网上都是这个名儿)。来进行转换,类似 java -jar sfnttool.jar -s '内容,也可以是文件' 源字符.ttf 生成的.ttf
3、如果字体还大于50K 的话,转换成 base64
4、如果小于50K,直接就可以引用了。。。。
大致这样。。
1、https://cloudconvert.com/otf-to-ttf
2、https://www.giftofspeed.com/base64-encoder/
参考:https://blog.zengrong.net/post/font_trim_replacement_converting/
jar 包的详细用法可以直接命令行看
java -jar sfnttool.jar -h
subset [-?|-h|-help] [-b] [-s string] fontfile outfile
prototype font subsetter
-?,-help print this help information
-s,-string string to subset
-b,-bench benchmark (run 10000 iterations)
-h,-hints strip hints
-w,-woff output woff format
-e,-eot output eot format
-x,-mtx enable microtype express compression for eot format
antv的 dialog 如何去掉边框

antv的 dialog 如何去掉边框

在用 antv 的 modal 对话框时,你会发现弹出来的框有一个很大的边框,打开 css 会找到 ant-modal-content 这个 class。如果你直接 加这个样式 padding: 0,或者 :deep(.ant-modal-content){padding: 0 }你会发现都不起作用

即使,即使你用了 important 也还是不起作用
这时候 看浏览器工具栏的右侧,会有类似 :where(xxxx) .ant-modal-content 这样的样式,也就是说他本身就是一个伪类,如果你直接对它操作是不起作用的。
网上找了很多资料。最后找到说,其实他有一个 wrap-class-name 的属性。用了这个属性后,整个对话框里的样式就可以跟着这个外层类走了。因此设定:<a-modal wrap-class-name="wrap-modal" ></a-modal>
再添加样式:
.wrap-modal{
.ant-modal-content{
padding: 0!important;
}
}
再次看弹窗。一切正常啦 ~

CSS如何给文字加上文字一半高度的背景色

一般来说象这种效果实现还是比较有意思的

在文字下层加上一定高度的背景色,半透明,而且模糊。。。
话不多说,上代码:
.text_bg {
display: inline-block;
position: relative;
z-index: 1;
}

.text_bg::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 40%;
background-color: #B6D16F;
opacity: .7;
z-index: -1;
filter: blur(1px); /* 可选:模糊效果 */
}
上述代码中最重要的其实就是那两个z-index。否则你会发现背景色其实压在了文字上方。
其他的基本上都是基本操作,只是额外用了一个:after的伪类。在当前这个例子里。用before和after的最终显示效果其实是一样的
unoconv中文不正常的解决方案

unoconv中文不正常的解决方案

用unoconv将wod转成pdf的时候,中文乱码,这时候解决方案往往是上传中文字体到系统库并注册即可。

中文字体网上下载的地方一堆堆的,就不再赘叙了。
主要就是注册 ,因为用到了mkfontscale之类的命令。但这不是系统自带的,需要安装,因为我用debian。于是:
# 使mkfontscale和mkfontdir命令正常运行
sudo apt-get install ttf-mscorefonts-installer
# 使fc-cache命令正常运行
sudo apt-get install fontconfig
然后在相应的字体目录下运行
mkfontscale
mkfontdir
fc-cache -fv //更新字体缓存
fc-list :lang-zh
然后一切正常
有时候你不得不说,CF还是挺不错的

有时候你不得不说,CF还是挺不错的

之前还在说用了CF后,连垃圾评论都没了。

结果,一通电话过来。说如果你再用CF,把IP指在国外,就直接取消备案了。然而CF国内版又用不起,也看了一下怎么个国内加速,还是有点繁琐,所以还是先暂时禁用吧。
其实用CF做代理的时候 ,还能享受直接https,现在我还得自己再配https。真烦人
而且,又开始收到垃圾评论了。
忍忍吧
expect: spawn id exp3 not open

expect: spawn id exp3 not open

在尝试使用 envoy 尝试自动部署的时候,遇到了问题,即:如果我要自己创建一个新的域名,那只能上线去执行 lnmp vhost add 的命令。

为什么要使用 lnmp 呢?其实他对我的作用只有一个,多版本的 PHP。因为现在在线上,各种不同版本的 PHP 都在跑,有 PHP5.6 / PHP7.1 / PHP8.1估计后面还会有更多的版本。
于是,我就想着用 expect 来处理

sudo /usr/bin/expect<<EOF
spawn lnmp vhost add
expect {
"Please enter domain" {send "{{$host}}\n";exp_continue}
"Enter more domain name" {send "\n";exp_continue}
"Please enter the directory" {send "\n";exp_continue}
"Allow Rewrite rule" {send "y\n";exp_continue}
"Default rewrite" {send "laravel\n";exp_continue}
"Enable PHP Pathinfo" {send "\n";exp_continue}
"Allow access log" {send "\n";exp_continue}
"Enable IPv6" {send "\n";exp_continue}
"Enter your choice " {send "\n";exp_continue}
"Add SSL Certificate" {send "\n";exp_continue}
"Press any key to start" {send "\r"; exp_continue}
}
expect eof
EOF
但执行后一直报错:
[mpass]: expect: spawn id exp3 not open
[mpass]: while executing
[mpass]: "expect eof"
仔细查了半天,原来最后一句还用了 exp_continue。。expect 认为还没有执行完。所以。就行报错了。
将最后一个 exp_contiue 删除。再次执行,就正常了
@task('lnmp' ,['on'=>'dev'])

@if($force)
sudo rm -rf /usr/local/nginx/conf/vhost/{{$host}}.conf
sudo rm -rf /home/wwwroot/{{$host}}
@endif
sudo /usr/bin/expect<<EOF
spawn lnmp vhost add
expect {
"Please enter domain" {send "{{$host}}\n";exp_continue}
"Enter more domain name" {send "\n";exp_continue}
"Please enter the directory" {send "\n";exp_continue}
"Allow Rewrite rule" {send "y\n";exp_continue}
"Default rewrite" {send "laravel\n";exp_continue}
"Enable PHP Pathinfo" {send "\n";exp_continue}
"Allow access log" {send "\n";exp_continue}
"Enable IPv6" {send "\n";exp_continue}
"Enter your choice " {send "\n";exp_continue}
"Add SSL Certificate" {send "\n";exp_continue}
"Press any key to start" {send "\r";}
}
expect eof
EOF
ls -lah /home/wwwroot/
@endtask
这样就 OK 了
10月回顾一下

10月回顾一下

之前本来有准备写内容,但不知道 怎么回事编辑器加载不出来直接报错,于是就放弃了。

10月没做什么事情,但大致流水账可以记一下:
1、Flutter 又重捡起来了,后面重心可能会在这一块 (安装个开发工具折腾了1天,主要是SDK更新,一更就死)
2、小程序 还在写,但下一波估计不用 UniAPP,可能会考虑Taro。
3、升级了操作系统到最新的,目前 没问题
4、又买了两台无忧。好象Zerotier会影响网速?准备重建一下planet。估计又要大折腾
新项目还是要上,老本没地儿吃了
phpstorm/webstorm中如何识别 vite 项目的@

phpstorm/webstorm中如何识别 vite 项目的@

在使用 phpstorm/webstorm 进行前端开发的时候,一般会设置 alias,比如@,但在 IDEA 中,如果项目是 vite/vuejs 的时候 ,无法识别路径。

网上教程很多,什么设置.eslintrc.js / jsconfig.json / tsconfig.json 之类的,但其实重启 IDE 后仍然无法识别。
查了一下资料,原来目前 phpstorm 对@的 alias,只支持 webpack,也就是说,如果你的前端项目是 webpack 的,其实是能够识别的。因此,只要在项目根目录下,随便建一个文件,尽量不要叫 webpack.config.js,以防被项目自动识别。你可以建一个 alias.config.js,内容如下:
const path = require("path");
module.exports = {
resolve: {
alias: {
'@': path.resolve(__dirname, 'resources/js'),
'~': path.resolve(__dirname, 'resources')
}
}
}
看到这个 resource/js 就知道当前是在 laravel 项目下面了。
在 Ide 的 setting中 :
Languaes & Frameworks > Javascript > Webpack ,选择手动,指定 alias.config.js ,确定后,再打开 *.vue 文件,会发现原来的 import 文件都能够自动识别了。
tailwindCss与 elementUI 的冲突解决

tailwindCss与 elementUI 的冲突解决

解决 tailwindCss 与 elementUI 最简单办法就是

1、在 app.js(或main.js)中,先加载 tailwindCss 再加载 elementUI 和相关 css
2、在 tailwind.config.js 中,plugins节点下,增加:
plugin(function ({addBase}) {
addBase({
".el-button": {
"background-color": "var(--el-button-bg-color,val(--el-color-white))"
}
})
}),
说白了,就是继续针对 el-button 重新赋值。
再打开页面就完全正常了。