Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

Commit

Permalink
add ascii_only for uglifyjs, Fix #996
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Sep 11, 2014
1 parent ffdb9c5 commit 290bde8
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ function buildFiles(files, args) {
$.transport(opt),
$.if(isJS, pipe(
$.if(isStandalone, standalonify(args)),
$.uglify()
$.uglify({
output: {
ascii_only: true
}
})
), $.cssmin()),
$.size2({
gzip: true,
Expand Down
12 changes: 12 additions & 0 deletions tests/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,18 @@ describe('build', function() {
});
});

it('uglifyjs with ascii-only', function(done) {
var opt = {
cwd: join(base, 'uglifyjs-ascii-only'),
dest: dest
};
build(opt, function(err) {
should.not.exist(err);
assets('uglifyjs-ascii-only', dest);
done();
});
});

function assets(prefix, dest) {
var expect = join(base, 'expect', prefix);
var expectFiles = glob.sync('**/*', {cwd: expect});
Expand Down
3 changes: 3 additions & 0 deletions tests/build/expect/uglifyjs-ascii-only/a/0.1.0/index-debug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
define("a/0.1.0/index-debug", [], function(require, exports, module) {
'中';
});
1 change: 1 addition & 0 deletions tests/build/expect/uglifyjs-ascii-only/a/0.1.0/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
define("a/0.1.0/index",[],function(){"\u4e2d"});
1 change: 1 addition & 0 deletions tests/build/uglifyjs-ascii-only/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'中';
6 changes: 6 additions & 0 deletions tests/build/uglifyjs-ascii-only/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "a",
"version": "0.1.0",
"spm": {
}
}

0 comments on commit 290bde8

Please sign in to comment.