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

添加一些代码

上级 4fcd11a2
...@@ -7,52 +7,26 @@ const concat = require('gulp-concat'); ...@@ -7,52 +7,26 @@ const concat = require('gulp-concat');
const autoprefixer = require ( 'gulp-autoprefixer' ); const autoprefixer = require ( 'gulp-autoprefixer' );
const replace = require('gulp-string-replace'); const replace = require('gulp-string-replace');
function browser() { function browser() {
htmlKF()
css() css()
jsKF()
watch('src/style/*.less', parallel(css,reload)) watch('src/style/*.less', parallel(css,reload))
watch('src/js/*.js', parallel(jsKF,reload)) watch('src/js/*.js', parallel(js,reload))
watch('src/**/*.pug',parallel(htmlKF,reload)) watch('src/**/*.pug',parallel(html,reload))
browserSync.init({ server: { browserSync.init({server: { baseDir: "./build/" , host: '0.0.0.0' }});
baseDir: "./build/" ,
host: '0.0.0.0'
} });
} }
function htmlKF() { function html() {
return src('src/*.pug') return src('src/*.pug').pipe(pug()).pipe(dest('build/'))
.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() { function css() {
return src('src/style/*.less') return src('src/style/*.less')
.pipe(less()) .pipe(less())
.pipe(autoprefixer({ .pipe(autoprefixer({ cascade : true ,remove : true }))
cascade : true ,
remove : true
}))
.pipe(minifyCSS()) .pipe(minifyCSS())
.pipe(dest('build/css')) .pipe(dest('build/css'))
} }
function jsKF() { function js() {
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 = ``; const buffer = ``;
return src('src/js/*.js', { sourcemaps: true }) return src('src/js/*.js', { sourcemaps: true })
.pipe(replace('// 这段注释是 js的客服提示部分,不要删除', buffer)) .pipe(replace('// 这段注释是 js的客服提示部分,不要删除', buffer))
...@@ -61,22 +35,16 @@ function jsNoKF() { ...@@ -61,22 +35,16 @@ function jsNoKF() {
} }
function build(cb) { function build(cb) {
htmlKF() html();
css() css();
jsKF() js();
cb() cb();
}
function noKFBuild(cb) {
htmlNoKF()
css()
jsNoKF()
cb()
} }
function reload(cb) { function reload(cb) {
browserSync.reload() browserSync.reload()
cb() cb()
} }
exports.default = browser exports.default = browser
exports.kfBuild = build exports.build = build
exports.noKFBuild = noKFBuild \ No newline at end of file
\ No newline at end of file
{ {
"name": "{{projectName}}", "name": "template",
"version": "1.0.0", "version": "1.0.0",
"description": "于2019年6月份开发的集思营销页移动端", "description": "jq项目",
"main": "index.js", "main": "index.js",
"license": "MIT", "license": "MIT",
"scripts": {}, "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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册