1 Star 0 Fork 1

工頁光軍/miniprogram-demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gulpfile.js 3.14 KB
一键复制 编辑 原始数据 按行查看 历史
VirtualStarry 提交于 2022-07-15 18:55 . 为小程序示例添加ar功能
const fs = require('fs')
const gulp = require('gulp')
const postcss = require('gulp-postcss')
const cssvars = require('postcss-css-variables')
const rename = require('gulp-rename')
const replace = require('gulp-replace')
const gulpIf = require('gulp-if')
const gulpIgnore = require('gulp-ignore')
gulp.task('transform-css-vars', () => {
const plugins = [
cssvars({
preserve: false,
variables: {
"--weui-BTN-DISABLED-FONT-COLOR": "rgba(0, 0, 0, .2)",
"--weui-BTN-DEFAULT-BG": "#f2f2f2",
"--weui-BTN-DEFAULT-COLOR": "#06ae56",
"--weui-BTN-DEFAULT-ACTIVE-BG": "#e6e6e6",
"--weui-DIALOG-LINE-COLOR": "rgba(0, 0, 0, .1)",
"--weui-BG-0": "#ededed",
"--weui-BG-1": "#f7f7f7",
"--weui-BG-2": "#fff",
"--weui-BG-3": "#f7f7f7",
"--weui-BG-4": "#4c4c4c",
"--weui-BG-5": "#fff",
"--weui-FG-0": "rgba(0, 0, 0, .9)",
"--weui-FG-HALF": "rgba(0, 0, 0, .9)",
"--weui-FG-1": "rgba(0, 0, 0, .5)",
"--weui-FG-2": "rgba(0, 0, 0, .3)",
"--weui-FG-3": "rgba(0, 0, 0, .1)",
"--weui-RED": "#fa5151",
"--weui-ORANGE": "#fa9d3b",
"--weui-YELLOW": "#ffc300",
"--weui-GREEN": "#91d300",
"--weui-LIGHTGREEN": "#95ec69",
"--weui-BRAND": "#07c160",
"--weui-BLUE": "#10aeff",
"--weui-INDIGO": "#1485ee",
"--weui-PURPLE": "#6467f0",
"--weui-WHITE": "#fff",
"--weui-LINK": "#576b95",
"--weui-TEXTGREEN": "#06ae56",
"--weui-FG": "#000",
"--weui-BG": "#fff",
"--weui-TAG-TEXT-ORANGE": "#fa9d3b",
"--weui-TAG-BACKGROUND-ORANGE": "rgba(250, 157, 59, .1)",
"--weui-TAG-TEXT-GREEN": "#06ae56",
"--weui-TAG-BACKGROUND-GREEN": "rgba(6, 174, 86, .1)",
"--weui-TAG-TEXT-BLUE": "#10aeff",
"--weui-TAG-BACKGROUND-BLUE": "rgba(16, 174, 255, .1)",
"--weui-TAG-TEXT-BLACK": "rgba(0, 0, 0, .5)",
"--weui-TAG-BACKGROUND-BLACK": "rgba(0, 0, 0, .05)",
"--weui-BG-COLOR-ACTIVE": "#ececec",
"--height": "44px",
"--right": "95px",
},
preserveInjectedVariables: false,
})
]
return gulp.src([
'./miniprogram/app.wxss',
'./miniprogram/common/common.wxss',
'./miniprogram/page/common/common.wxss',
'./miniprogram/page/common/index.wxss',
'./miniprogram/page/component/index.wxss',
'./miniprogram/page/cloud/index.wxss',
'./miniprogram/page/API/index.wxss',
'./miniprogram/page/extend/index.wxss',
'./miniprogram/packageComponent/pages/canvas/canvas-2d/canvas-2d.wxss',
])
.pipe(gulpIgnore.exclude(
file => {
try {
fs.accessSync(file.path.replace(/\.wxss$/, '-skyline.wxss'))
} catch(e) {
return false
}
return true
}))
.pipe(postcss(plugins))
.pipe(replace(/\:root ?{}\n/g, ''))
.pipe(gulpIf(file => file.path.includes('miniprogram/page/common'), rename({suffix: '-skyline'})))
.pipe(gulpIf(file => file.path.includes('miniprogram/common'), rename({suffix: '-skyline'})))
.pipe(gulp.dest(file => file.base))
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hmoob_xiang_hui/miniprogram-demo.git
git@gitee.com:hmoob_xiang_hui/miniprogram-demo.git
hmoob_xiang_hui
miniprogram-demo
miniprogram-demo
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385