1 Star 0 Fork 0

李国师 / nodemon-gulp-express

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

说明

该项目将传统的html页面进行拆分,根据配置打包成多页。 page-config.js的components数组包含的组件配置中,所有script被合并成一个以page命名的js;所有style.less 会被合并成以page命名的css

开发模式下ejs由express渲染,打包时通过gulp-ejs打包成html或其他文件。

安装

npm install

开发模式

用node作为服务

npm run serve

它只是不跑node服务,而只用其它(如java)作为服务,其它都一样

npm run serve:other

// 最终打包输入,先生成less,js,html, 然后拷贝到发布目录

npm run build

其它

// 合并样式文件
gulp less

// 合并js文件
gulp js

// ejs模板生成页面文件
gulp ejs

// 拷贝publishSource静态文件复制到publishPath的目录
gulp static

gulp生成配置

page-config.js

// 文件生成的目录,如果使用本项目的node服务开发,可以直接生成到public,须在routes中配置路由
const tempStatic = 'public'
// 文件生成的目录,例如生成到java项目中,此时需要设置代理地址
const javaStatic = 'javaproject'
// 改配置用于控制js,css,的处理与合并,拷贝
module.exports = {
    // browser-sync 的代理地址,可实现热更新
    serverProxy: 'http://localhost:3000',
    tempStatic,
    javaStatic,
    // 发布相关
    publishPath: 'dist/',
    // 静态文件地址
    publishSource: [
        `${tempStatic}/**/*.*`,
    ],
    // 文件如果没有配置output,则默认放在此位置
    defaultOutput: './public',
    pages: [
        {
            components: [{
                base: 'src/views/bigscreen',
                // 默认会合并目录下所有的js,less
                blocks: ['left', 'right']
            }, {
                base: 'src/components/common',
                blocks: ['header', 'bottom']
            }, {
                base: 'src/components',
                blocks: [
                    {
                        name: 'utils',
                        // 如果想指定合并的顺序,可以这么写。如果没有指定,会按默认顺序合并。
                        files: {
                            js: ['event', 'resize']
                        }
                    }
                ]
            }],
            page: 'bigscreen',
            entryFolder: 'src/views/bigscreen',
            entryFile: {
                dev: 'htmlPage',
                prod: 'jspPage'
            },
             // files 用来定义合并顺序
             files: {
                js: ['main']
            },
            output: {
                js: `/js`,
                less: `/css`,
                ejs: `/pages`
            },
            ejsFormat: '.html'
        }
    ]
}
MIT License Copyright (c) 2021 李国师 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于express, gulp, nodemon, 支持 less, 支持页面自动更新。为传统开发jquery项目提供一个开发环境。 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
NodeJS
1
https://gitee.com/chesterlgs/nodemon-gulp-express.git
git@gitee.com:chesterlgs/nodemon-gulp-express.git
chesterlgs
nodemon-gulp-express
nodemon-gulp-express
master

搜索帮助