webpack@next webpack-multi-page-cli 多页脚手架2.0

根据自己的经验和想法,对原有的1.x版本进行的大版本的升级。在实际工作中,能结合的应用场景会更加多元化。

github:https://github.com/pomelott/webpack-multi-page-cli

如对您有帮助,请给星已鼓励,如有问题请issue。 本多页面向实际工作流,会持续更新。

webpackMultiPageCli based on webpack@latest. This cli can provide:

  1. More flexible directory structure
  2. More comprehensive build functions
  3. Much Higher scalability
  4. More active and frequent maintenance

Fast Use

  • download the dependences
    npm install
  • running with development mode
    npm run dev
  • running with production mode
    npm run build
  • running with analyzer
    npm run analyze

Use in your work && customize HTML

cli will create the entry automatically accoriding to you pageDir, in this cli, one page crrespond to one pageDir, and you can custom your page by two methods as follows:

  1. use param.js and entry.js

if there is a param.js, cli will resolve this with the default html template written in pug engine, and entry.js is the crrespond entrance file of assets that will be inlined in the resolved html.

  • the config of param.js as follows:
    NameTypeDefaultDescription
    titleString'multi-page-cli'the text of title-tag in html
    tagObject{meta: [],eadLink: [],headScript: [],bodyLink: [],bodyScript: []}cotrol the assets tags
    tag.metaArray[]control meta tag
    tag.headLinkArray[ ]control link tag in head section
    tag.headScriptArray[ ]control script tag in head section
    tag.bodyLinkArray[ ]control link tag in body section
    tag.bodyScriptArray[ ]control script tag in body section
    vueInitObject{}control the root instance of Vue
    vueInit.elStringundefinedel attribute of vue instance, such as '#app'
    vueInit.entranceStringundefinedcontrol the entrance vue component
    // for detai code, you can view vueDemo in dev mode
    module.exports = {
        title: 'Example in Multi-Page',
        tag: {
            meta: [{
                name: 'webpack-multi-page-cli',
                content: 'vueDemo'
            }, {
                name: "webpack-multi-page-cli",
                content: 'https://github.com/pomelott/webpack4.x_Demo'
            }],
            headLink: [{
                rel: "icon",
                type: "image/png",
                href: 'https://vuejs.bootcss.com/images/logo.png'
            },{
                href: 'https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.0/animate.min.css',
                rel: "stylesheet"
            }]
        },
        vueInit: {
            el: '#app',
            entrance: 'example'
        }
    }
    <!doctype html>
    <html lang="en">

    <head>
        <title>Example in Multi-Page</title>
        <meta name="webpack-multi-page-cli" content="vueDemo" />
        <meta name="webpack-multi-page-cli" content="https://github.com/pomelott/webpack4.x_Demo" />
        <link rel="icon" type="image/png" href="https://vuejs.bootcss.com/images/logo.png" />
        <link href="https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.0/animate.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="http://www.cdn-plugin.com/assets/css/entry/example/vueDemo.css?v=2466d76ff005024cce26">
    </head>

    <body>
        <div id="app">
            <div is="example"></div>
        </div>
        <script src="http://www.cdn-plugin.com/assets/js/runtime/runtime-vueDemo.js?v=2466d76ff005024cce26"></script>
        <script src="http://www.cdn-plugin.com/assets/js/common/vendors.js?v=5b4f3badf8d6ddb0036f"></script>
        <script src="http://www.cdn-plugin.com/assets/js/entry/example/vueDemo.js?v=8df1c19f97ce1a9abf72"></script>
    </body>

    </html>

 

更详细的文档详见github : https://github.com/pomelott/webpack-multi-page-cli

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值