Skip to content

Commit

Permalink
feat: minify options
Browse files Browse the repository at this point in the history
  • Loading branch information
fishbar committed Mar 17, 2018
1 parent 7be2809 commit b7251ac
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ Cube.debug();
* debug {Boolean}
* version {Number}
* timeout {Number}
* minify {Object} config for esminify's options config
* minify {Object} config for esminify's options.config
* mangle:
* builtIns:
* ......
*/
Cube.init(options);
Expand Down
3 changes: 2 additions & 1 deletion lib/cube/ext_api_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,13 @@ function fixRightPart(cube, root, filepath, node, release/*, map*/) {
function genCode(cube, qpath, ast, compress) {
if (compress) {
let minifyOpt = cube.config.minify;
let opt = _.merge({}, minifyOpt);
let opt = {};
if (typeof ast === 'string') {
opt.code = ast;
} else {
opt.ast = ast;
}
opt.config = minifyOpt;
return esminify.minify(opt);
} else {
if (typeof ast === 'string') {
Expand Down
4 changes: 2 additions & 2 deletions runtime/cube.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 23 additions & 23 deletions runtime/cube_clean_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@
if (base) {
base = base.src.replace(/[^/]+\.js/, '__clean_cache__');
}
document.body.appendChild(a);
a.onmouseover = function () {
this.style.opacity = '0.8';
};
a.onmouseout = function () {
this.style.opacity = '0.2';
};
a.onclick = function () {
if (!base) {
return;
}
let img = document.createElement('img');
img.src = base;
img.onerror = function () {
delete img.onerror;
delete img;
location.reload();
document.addEventListener('DOMContentLoaded', function () {
document.body.appendChild(a);
a.onmouseover = function () {
this.style.opacity = '0.8';
};
img.onload = function () {
delete img.onerror;
delete img;
location.reload();
a.onmouseout = function () {
this.style.opacity = '0.2';
};
};
})();
a.onclick = function () {
if (!base) {
return;
}
let img = document.createElement('img');
img.src = base;
img.onerror = function () {
delete img.onerror;
location.reload();
};
img.onload = function () {
delete img.onerror;
location.reload();
};
};
});
})();

0 comments on commit b7251ac

Please sign in to comment.