Add Uglify; gzip for demo (#7)
Add Uglify for minification. Gzip the bundle so the toolbar is served gzipped for the demo (now only 3.3Kb!) Update the author, license and repository fields for the package.json
This commit is contained in:
Родитель
24717f8ada
Коммит
76649cff5e
|
@ -3,5 +3,9 @@ dist/
|
|||
*.js
|
||||
*.js.map
|
||||
*.d.ts
|
||||
|
||||
!injectDemoToolbar.user.js
|
||||
!commontypes.d.ts
|
||||
!webpack.common.js
|
||||
!webpack.prod.js
|
||||
!gzip.js
|
|
@ -0,0 +1,7 @@
|
|||
const zlib = require('zlib');
|
||||
const gzip = zlib.createGzip();
|
||||
const fs = require('fs');
|
||||
const inp = fs.createReadStream('./dist/bundle.js');
|
||||
const out = fs.createWriteStream('./dist/bundle.js.gz');
|
||||
|
||||
inp.pipe(gzip).pipe(out);
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
16
package.json
16
package.json
|
@ -4,24 +4,22 @@
|
|||
"description": "A toolbar for monitoring web performance.",
|
||||
"main": "dist/bundle.js",
|
||||
"scripts": {
|
||||
"build": "webpack",
|
||||
"build": "webpack --config webpack.prod.js",
|
||||
"test": "karma start karma.conf.js",
|
||||
"test-once": "karma start karma.conf.js --single-run",
|
||||
"demo": "npm run build && http-server -o -c-1",
|
||||
|
||||
"demo": "npm run build && node gzip.js && http-server -g -o -c-1",
|
||||
"tslint": "tslint -p .",
|
||||
"tsc": "tsc -p tsconfig.json",
|
||||
"tsc-verbose": "tsc -p tsconfig.json --traceResolution true",
|
||||
|
||||
"test-tslint": "tslint -p test/.",
|
||||
"test-tsc": "tsc -p test/tsconfig.json",
|
||||
"test-tsc-verbose": "tsc -p test/tsconfig.json --traceResolution true",
|
||||
|
||||
"check": "npm run tslint && npm run test-tslint && npm run test-tsc && npm run tsc && npm run test-once"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "",
|
||||
"author": "Microsoft",
|
||||
"license": "MIT",
|
||||
"repository": "github:Microsoft/webperftoolbar",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.0.10",
|
||||
"@types/mocha": "^2.2.44",
|
||||
|
@ -45,6 +43,8 @@
|
|||
"tslib": "^1.8.1",
|
||||
"tslint": "5.8.0",
|
||||
"typescript": "^2.6.2",
|
||||
"webpack": "^3.10.0"
|
||||
"uglifyjs-webpack-plugin": "^1.1.6",
|
||||
"webpack": "^3.10.0",
|
||||
"webpack-merge": "^4.1.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
const merge = require('webpack-merge');
|
||||
const UglifyJsWebpackPlugin = require('uglifyjs-webpack-plugin');
|
||||
const common = require('./webpack.common');
|
||||
|
||||
module.exports = merge(common, {
|
||||
plugins: [
|
||||
new UglifyJsWebpackPlugin()
|
||||
]
|
||||
});
|
Загрузка…
Ссылка в новой задаче