用户
 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,登录网站

小程序社区 首页 教程 实用组件/插件 查看内容

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

天下雪 2017-4-18 00:04

作者:billfeller,来自原文地址一:使用Sublime Text开发小程序设置wxml,wcss直接按html,css语法高亮代码片段https://github.com/Abbotton/weapp-snippet-for-sublime-text-2-3二:微信小程序打包算法\Tencent\微 ...

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

相关阅读