小程序模板网

使用Sublime Text开发小程序,小程序打包算法

作者:billfeller,来自原文地址

 

 

设置wxml,wcss直接按html,css语法高亮 

代码片段 
https://github.com/Abbotton/weapp-snippet-for-sublime-text-2-3

 

二:微信小程序打包算法

\Tencent\微信web开发者工具\package.nw\app\dist\weapp\commit\pack.js

 

				
  1. "use strict";
  2.  
  3. function init() {
  4. var e = require("glob"),
  5. r = require("fs"),
  6. n = require("path"),
  7. t = require("../../common/log/log.js");
  8. _exports = function(f, u, i) {
  9. var c = 0,
  10. a = 1,
  11. o = 2,
  12. B = 3,
  13. w = 4,
  14. l = [new Buffer(1), new Buffer(4), new Buffer(4), new Buffer(4), new Buffer(1)];
  15. l[c].writeIntLE(190), l[a].writeInt32BE(1), l[w].writeIntLE(237);
  16. var s = 0,
  17. v = [],
  18. h = [],
  19. g = [],
  20. p = [],
  21. E = [];
  22. e(f + "/**", {
  23. nodir: !0
  24. }, function(e, c) {
  25. if (e) t.error(e);
  26. else {
  27. s = c.length, c.forEach(function(e) {
  28. var t = r.readFileSync(e),
  29. u = n.relative(f, e),
  30. i = new Buffer("/" + u.replace(/\\/g, "/"));
  31. g.push(i), p.push(t)
  32. });
  33. var a = 18 + 12 * s + Buffer.concat(g).length;
  34. h = g.map(function(e, r) {
  35. var n = new Buffer(4);
  36. n.writeInt32BE(e.length);
  37. var t = new Buffer(4),
  38. f = p[r].length,
  39. u = a;
  40. t.writeInt32BE(u), a += f;
  41. var i = new Buffer(4);
  42. return i.writeInt32BE(f), Buffer.concat([n, e, t, i])
  43. });
  44. var w = new Buffer(4);
  45. w.writeInt32BE(s), h.unshift(w), v = Buffer.concat(h), E = Buffer.concat(p), l[o].writeInt32BE(v.length), l[B].writeInt32BE(E.length), l = Buffer.concat(l);
  46. var I = Buffer.concat([l, v, E]);
  47. r.writeFileSync(u, I), t.info("pack.js create " + u + " success!"), i(null, u)
  48. }
  49. })
  50. }
  51. }
  52. var _exports;
  53. init(), module.exports = _exports;


易优小程序(企业版)+灵活api+前后代码开源 码云仓库:starfork
本文地址:https://www.eyoucms.com/wxmini/doc/course/23550.html 复制链接 如需定制请联系易优客服咨询:800182392 点击咨询
QQ在线咨询