From f659a47d779a3f38630604553db1c4eb5d081da4 Mon Sep 17 00:00:00 2001 From: npmrun <1549469775@qq.com> Date: Tue, 26 Oct 2021 01:13:44 +0800 Subject: [PATCH] add --- gulpfile.js/config.js | 1 + gulpfile.js/index.js | 10 +++++----- gulpfile.js/util.js | 6 ++++-- readme.md | 0 src/css/index/index.less | 6 +++++- src/html/__include/header.pug | 2 +- src/html/index.pug | 2 +- 7 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 gulpfile.js/config.js create mode 100644 readme.md diff --git a/gulpfile.js/config.js b/gulpfile.js/config.js new file mode 100644 index 0000000..03fdeac --- /dev/null +++ b/gulpfile.js/config.js @@ -0,0 +1 @@ +exports.srcPath = 'src' \ No newline at end of file diff --git a/gulpfile.js/index.js b/gulpfile.js/index.js index ecd9f96..3ee02ec 100644 --- a/gulpfile.js/index.js +++ b/gulpfile.js/index.js @@ -11,7 +11,7 @@ const { getPages } = require('./util'); const browserSync = require('browser-sync').create(); const reload = browserSync.reload; -let srcPath = "src" +const { srcPath } = require("./config") let isProd = process.env.NODE_ENV === "production" @@ -121,10 +121,10 @@ function watchTask() { .on("change", reload) .on("unlink", reload) }) - // watch([`${srcPath}/html/**/*`], allTask(pageFn)) - // .on("add", reload) - // .on("change", reload) - // .on("unlink", reload) + watch([`${srcPath}/html/__**/*`], allTask(pageFn)) + .on("add", reload) + .on("change", reload) + .on("unlink", reload) } exports.watch = series(remove,static, common, allTask(asset), allTask(pageFn), watchTask) diff --git a/gulpfile.js/util.js b/gulpfile.js/util.js index 0bec39c..dda53f5 100644 --- a/gulpfile.js/util.js +++ b/gulpfile.js/util.js @@ -1,9 +1,11 @@ const glob = require('glob') const path = require('path') +const { srcPath } = require("./config") + function getPages (exclude = []) { - let pageList = glob.sync(path.resolve(process.cwd(), "src/html/*.pug"), { - ignore: path.resolve(process.cwd(), "src/**/__*/**") + let pageList = glob.sync(path.resolve(process.cwd(), srcPath + "/html/*.pug"), { + ignore: path.resolve(process.cwd(), srcPath + "/**/__*/**") }) pageList = pageList.map(v => { let leftIndex = v.lastIndexOf('/') diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e69de29 diff --git a/src/css/index/index.less b/src/css/index/index.less index bb08adf..517f0fd 100644 --- a/src/css/index/index.less +++ b/src/css/index/index.less @@ -72,7 +72,7 @@ .card{ color: #333333; height: 70px; - margin: 8px 10px; + margin: 0 10px 8px; background-color: rgba(255, 254, 248, 0.44); border-radius: 4px; padding: 5px 10px; @@ -132,6 +132,10 @@ } .search-box{ + display: inline-block; + text-align: center; + display: flex; + justify-content: center; .input-wrapper{ display: flex; align-items: center; diff --git a/src/html/__include/header.pug b/src/html/__include/header.pug index b79d855..3854ae5 100644 --- a/src/html/__include/header.pug +++ b/src/html/__include/header.pug @@ -1,6 +1,6 @@ - var menulist = [ - {text: "首页", path: "#"}, + {text: "首页", path: "/"}, {text: "Demo", path: "/demo"}, {text: "关于", path: "/about"}, ]; diff --git a/src/html/index.pug b/src/html/index.pug index 3b1df3c..9648e53 100644 --- a/src/html/index.pug +++ b/src/html/index.pug @@ -21,7 +21,7 @@ block content label(for="search").icon include __include/icon/search input(type="search" placeholder="请输入搜索" id="search") - .row(style="margin: 0 -10px;") + .row(style="margin: 8px -10px 0;") .col-lg-6.col-md-8.col-xs-12.col-6 a(href="#").card .card__left