一分钟学会 定制项目构建流程

我的定制的微信小程序目录结构: 项目目录\build-templates\wx\game.json , 可是这样构建后的项目使用的还是默认的game.json。是我的结构有什么问题吗?

萌新文文 大神 ,, 定制项目构建流程 是干嘛用的?

就是想定制发布后的项目啊。 比如想增加一些文件到发布后的项目中

微信小游戏的目录是 wechatgame @黑的不彻底

mark

@jare 创建build-templates/web-mobile/index.html,然后每次build后,所有脚本名字都变了,然而web-mobile 饮用的脚本名字不会跟着改变,还是需要手动改啊。。。

很旧的版本是有这个问题,1.9 还是什么的版本修好了

@jare 我用的是1.9.3 ,还是这个问题,build后,还只是简单的拷贝 build-templates/web-mobile/index.html ,引用脚本名字,每次还是需要自己手动修改。

引用的什么脚本的名字?

@jare 就是引用“src/settings”,“main.js" 这两个脚本啊,每次build,这两个脚本名字都会改变,

对啊,变是正常的,因为构建时你勾选了 md5。不变才奇怪了。

请问是否有开关 什么时候用 自定义架构流程 什么时候不用 有吗?

@jare
抱歉翻出陈年旧帖。

我按照build-templates目录结构放了一个 index.html进去,改了一点js代码,构建完成确实被替换了,但是里面的 <=webDebugger>没有被替换成 vconsole.min.xxxx.js

这个麻烦确认下是不是有问题,多谢了

cocos creator 2.0.8
web-mobile

里面不应该有 <=webDebugger>
你应该使用完整版的 index.html

膜拜~~~

完整的html文件


<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">

  <title>Cocos Creator | <%=project%></title>

  <!--http://www.html5rocks.com/en/mobile/mobifying/-->
  <meta name="viewport"
        content="width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1"/>

  <!--https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html-->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  <meta name="format-detection" content="telephone=no">

  <!-- force webkit on 360 -->
  <meta name="renderer" content="webkit"/>
  <meta name="force-rendering" content="webkit"/>
  <!-- force edge on IE -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  <meta name="msapplication-tap-highlight" content="no">

  <!-- force full screen on some browser -->
  <meta name="full-screen" content="yes"/>
  <meta name="x5-fullscreen" content="true"/>
  <meta name="360-fullscreen" content="true"/>
  
  <!-- force screen orientation on some browser -->
  <meta name="screen-orientation" content="<%=orientation%>"/>
  <meta name="x5-orientation" content="<%=orientation%>">

  <!--fix fireball/issues/3568 -->
  <!--<meta name="browsermode" content="application">-->
  <meta name="x5-page-mode" content="app">

  <!--<link rel="apple-touch-icon" href=".png" />-->
  <!--<link rel="apple-touch-icon-precomposed" href=".png" />-->

  <link rel="stylesheet" type="text/css" href="style-mobile.css"/>

</head>
<body>
  <canvas id="GameCanvas" oncontextmenu="event.preventDefault()" tabindex="0"></canvas>
  <div id="splash">
    <div class="progress-bar stripes">
      <span style="width: 0%"></span>
    </div>
  </div>
<script src="src/settings.js" charset="utf-8"></script>
<%=webDebugger%>
<script src="main.js" charset="utf-8"></script>

<script type="text/javascript">
  (function () {
      // open web debugger console
      if (typeof VConsole !== 'undefined') {
          window.vConsole = new VConsole();
      }
  
      var splash = document.getElementById('splash');
      splash.style.display = 'block';
  
      var isStart = false;
      var checkLoad = function(){
        if (!isStart){
            var cocos2d = document.createElement('script');
            cocos2d.async = true;
            cocos2d.src = window._CCSettings.debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js';
            var engineLoaded = function () {
                document.body.removeChild(cocos2d);
                cocos2d.removeEventListener('load', engineLoaded, false);
                window.boot();
            };
            cocos2d.addEventListener('load', engineLoaded, false);
            document.body.appendChild(cocos2d);
            isStart = true;
        }
      }
      window.LUAGameManager = {};
      window.LUAGameManager.WebViewReady = checkLoad;
  
      setTimeout( checkLoad,1500);
  })();
  </script>

</body>
</html>


另外不仅是<=webDebugger>,<=orientation>也没有替换。
麻烦大佬看下了 @jare

不是,你正常构建后的 index.html 就是完整的了

问下怎么拷贝整个文件夹,要递归每个文件然后读写吗?有没有调用cmd命令的方法?
小程序的子域每次要两个项目切换很麻烦,想直接拷贝

可以参考一下 node 的 fs-extra 模块,有现成的 copy 方法可以使用

mark