提交 99f8f9b4 编写于 作者: 邱上哲's avatar 邱上哲

添加一些代码

上级 4fcd11a2
......@@ -7,52 +7,26 @@ 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'
} });
watch('src/js/*.js', parallel(js,reload))
watch('src/**/*.pug',parallel(html,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 html() {
return src('src/*.pug').pipe(pug()).pipe(dest('build/'))
}
function css() {
return src('src/style/*.less')
.pipe(less())
.pipe(autoprefixer({
cascade : true ,
remove : true
}))
.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() {
function js() {
const buffer = ``;
return src('src/js/*.js', { sourcemaps: true })
.pipe(replace('// 这段注释是 js的客服提示部分,不要删除', buffer))
......@@ -61,22 +35,16 @@ function jsNoKF() {
}
function build(cb) {
htmlKF()
css()
jsKF()
cb()
}
function noKFBuild(cb) {
htmlNoKF()
css()
jsNoKF()
cb()
html();
css();
js();
cb();
}
function reload(cb) {
browserSync.reload()
cb()
}
exports.default = browser
exports.kfBuild = build
exports.noKFBuild = noKFBuild
\ No newline at end of file
exports.build = build
\ No newline at end of file
{
"name": "{{projectName}}",
"name": "template",
"version": "1.0.0",
"description": "于2019年6月份开发的集思营销页移动端",
"description": "jq项目",
"main": "index.js",
"license": "MIT",
"scripts": {},
......
<!DOCTYPE html>
html(lang="en")
head
meta(charset="UTF-8")
meta(name="viewport", content="width=device-width, initial-scale=1.0")
meta(http-equiv="X-UA-Compatible", content="ie=edge")
title
body
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册