Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录/注册
切换导航
T
template-jq
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
template
template-jq
提交
4fcd11a2
提交
4fcd11a2
编写于
7月 31, 2019
作者:
邱上哲
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提交
上级
10405a20
变更
2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
85 行增加
和
0 行删除
+85
-0
.gitignore
.gitignore
+3
-0
gulpfile.js
gulpfile.js
+82
-0
未找到文件。
.gitignore
0 → 100644
浏览文件 @
4fcd11a2
node_modules
build
yarn.lock
\ No newline at end of file
gulpfile.js
0 → 100644
浏览文件 @
4fcd11a2
const
{
src
,
dest
,
parallel
,
watch
}
=
require
(
'gulp'
);
const
browserSync
=
require
(
'browser-sync'
).
create
();
const
pug
=
require
(
'gulp-pug'
);
const
less
=
require
(
'gulp-less'
);
const
minifyCSS
=
require
(
'gulp-csso'
);
const
concat
=
require
(
'gulp-concat'
);
const
autoprefixer
=
require
(
'gulp-autoprefixer'
);
const
replace
=
require
(
'gulp-string-replace'
);
function
browser
()
{
htmlKF
()
css
()
jsKF
()
watch
(
'src/style/*.less'
,
parallel
(
css
,
reload
))
watch
(
'src/js/*.js'
,
parallel
(
jsKF
,
reload
))
watch
(
'src/**/*.pug'
,
parallel
(
htmlKF
,
reload
))
browserSync
.
init
({
server
:
{
baseDir
:
"./build/"
,
host
:
'0.0.0.0'
}
});
}
function
htmlKF
()
{
return
src
(
'src/*.pug'
)
.
pipe
(
replace
(
'//- 这里的提示是为了给脚本定位打包的时候自动插入客服的不要删'
,
'script(src="https://tb.53kf.com/code/code/10191018/3")'
))
.
pipe
(
pug
())
.
pipe
(
dest
(
'build/'
))
}
function
htmlNoKF
()
{
return
src
(
'src/*.pug'
)
.
pipe
(
replace
(
'//- 这里的提示是为了给脚本定位打包的时候自动插入客服的不要删'
,
''
))
.
pipe
(
pug
())
.
pipe
(
dest
(
'build/'
))
}
function
css
()
{
return
src
(
'src/style/*.less'
)
.
pipe
(
less
())
.
pipe
(
autoprefixer
({
cascade
:
true
,
remove
:
true
}))
.
pipe
(
minifyCSS
())
.
pipe
(
dest
(
'build/css'
))
}
function
jsKF
()
{
const
buffer
=
`window.open('https://www26.53kf.com/webCompany.php?kf_sign=TYxOTMTU1OQ2MTEwNjQzMzU0Nzg4MDA3NzIxOTEwMTg=&arg=10191018&style=3&language=zh-cn&charset=GBK&kflist=off&kf=&zdkf_type=1&lnk_overflow=0&callback_id6ds=&referer=http%3A%2F%2Flocalhost%3A3000%2F&keyword=http%3A%2F%2Flocalhost%3A3000%2F&tfrom=1&tpl=crystal_blue&uid=b6385c8ea617caf08224345b545969e1&is_group=&is_group=&timeStamp=1559619541851&ucust_id=', '_blank', 'height=600,width=800,top=50,left=200,status=yes,toolbar=no,menubar=no,resizable=yes,scrollbars=no,location=no,titlebar=no')`
;
return
src
(
'src/js/*.js'
,
{
sourcemaps
:
true
})
.
pipe
(
replace
(
'// 这段注释是 js的客服提示部分,不要删除'
,
buffer
))
.
pipe
(
concat
(
'app.min.js'
))
.
pipe
(
dest
(
'build/js'
,
{
sourcemaps
:
true
}))
}
function
jsNoKF
()
{
const
buffer
=
``
;
return
src
(
'src/js/*.js'
,
{
sourcemaps
:
true
})
.
pipe
(
replace
(
'// 这段注释是 js的客服提示部分,不要删除'
,
buffer
))
.
pipe
(
concat
(
'app.min.js'
))
.
pipe
(
dest
(
'build/js'
,
{
sourcemaps
:
true
}))
}
function
build
(
cb
)
{
htmlKF
()
css
()
jsKF
()
cb
()
}
function
noKFBuild
(
cb
)
{
htmlNoKF
()
css
()
jsNoKF
()
cb
()
}
function
reload
(
cb
)
{
browserSync
.
reload
()
cb
()
}
exports
.
default
=
browser
exports
.
kfBuild
=
build
exports
.
noKFBuild
=
noKFBuild
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录