Skip to content

Commit ea629b3

Browse files
committed
📝 Display bundle size badge
1 parent 9cc4a08 commit ea629b3

File tree

6 files changed

+33
-30
lines changed

6 files changed

+33
-30
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
dist/
22
node_modules/
3-
.rpt2_cache/
3+
.rpt2_cache/
4+
.tmp/

.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea/
2+
.rpt2_cache/
3+
4+
.editorconfig
5+
.travis.yml

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# 💪 fit-html
22

33
[![Travis](https://img.shields.io/travis/Festify/fit-html.svg)](https://travis-ci.org/Festify/fit-html)
4+
![Bundle Size](http://img.badgesize.io/https://unpkg.com/fit-html/.tmp/index.min.js?compression=gzip)
45
[![Greenkeeper badge](https://badges.greenkeeper.io/Festify/fit-html.svg)](https://greenkeeper.io/)
56

6-
5KB web components + lit-html + redux library without bloat.
7+
3KB web components + lit-html + redux library without bloat.
78

89
## Overview
910

10-
fit-html is a combination of [lit-html](https://github.com/Polymer/lit-html), web components and [redux](http://redux.js.org/) bringing efficient rendering and a functional application architecture together. Yet, the total size of the framework is below 5KB<sup>1</sup>, including dependencies.
11+
fit-html is a combination of [lit-html](https://github.com/Polymer/lit-html), web components and [redux](http://redux.js.org/) bringing efficient rendering and a functional application architecture together. Yet, the total size of the framework is below 3KB, including dependencies.
1112

1213
## Small Example
1314

@@ -89,5 +90,3 @@ Please see https://github.com/Festify/fit-html-demo for more and larger examples
8990
## License
9091

9192
MIT
92-
93-
<sup>1</sup>: fit-html weighs in at about 3.2kb right now

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fit-html",
3-
"version": "0.5.1",
3+
"version": "0.5.2",
44
"description": "5KB functional Web Components without bloat",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -10,12 +10,8 @@
1010
"private": false,
1111
"bundlesize": [
1212
{
13-
"path": "dist/bundle.min.js",
14-
"maxSize": "2 kb"
15-
},
16-
{
17-
"path": "dist/bundle+deps.min.js",
18-
"maxSize": "5 kb"
13+
"path": ".tmp/index.min.js",
14+
"maxSize": "3 kb"
1915
}
2016
],
2117
"devDependencies": {
@@ -25,6 +21,7 @@
2521
"rollup-plugin-babel-minify": "^4.0.0",
2622
"rollup-plugin-commonjs": "^8.3.0",
2723
"rollup-plugin-node-resolve": "^3.0.3",
24+
"rollup-plugin-replace": "^2.0.0",
2825
"rollup-plugin-typescript2": "^0.11.1",
2926
"tslint": "^5.9.1",
3027
"typescript": "^2.5.3"
@@ -34,8 +31,8 @@
3431
"redux": "^3.7.2"
3532
},
3633
"scripts": {
37-
"build": "yarn lint && tsc",
38-
"check-size": "rollup -c && bundlesize && rm dist/bundle*",
34+
"build": "yarn lint && tsc && NODE_ENV=production rollup -c",
35+
"check-size": "yarn build && bundlesize",
3936
"fix": "tslint -p tsconfig.json --fix",
4037
"lint": "tslint -p tsconfig.json"
4138
}

rollup.config.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
11
import minify from 'rollup-plugin-babel-minify';
22
import cjs from 'rollup-plugin-commonjs';
33
import nodeResolve from 'rollup-plugin-node-resolve';
4+
import replace from 'rollup-plugin-replace';
45
import typescript from 'rollup-plugin-typescript2';
56

6-
export default [{
7+
export default {
78
input: 'src/index.ts',
89
output: {
9-
file: 'dist/bundle.min.js',
10-
format: 'es',
11-
sourcemap: false,
12-
},
13-
plugins: [ // No nodeResolve here to avoid bundling dependencies
14-
typescript(),
15-
cjs(),
16-
minify({ comments: false }),
17-
],
18-
}, {
19-
input: 'src/index.ts',
20-
output: {
21-
file: 'dist/bundle+deps.min.js',
22-
format: 'es',
10+
file: '.tmp/index.min.js',
11+
format: 'umd',
12+
name: 'FitHtml',
2313
sourcemap: false,
2414
},
2515
plugins: [
2616
nodeResolve({ browser: true }),
2717
typescript(),
2818
cjs(),
19+
replace({
20+
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'develop'),
21+
}),
2922
minify({ comments: false }),
3023
],
31-
}];
24+
};

yarn.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,14 @@ rollup-plugin-node-resolve@^3.0.3:
17241724
is-module "^1.0.0"
17251725
resolve "^1.1.6"
17261726

1727+
rollup-plugin-replace@^2.0.0:
1728+
version "2.0.0"
1729+
resolved "https://registry.yarnpkg.com/rollup-plugin-replace/-/rollup-plugin-replace-2.0.0.tgz#19074089c8ed57184b8cc64e967a03d095119277"
1730+
dependencies:
1731+
magic-string "^0.22.4"
1732+
minimatch "^3.0.2"
1733+
rollup-pluginutils "^2.0.1"
1734+
17271735
rollup-plugin-typescript2@^0.11.1:
17281736
version "0.11.1"
17291737
resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.11.1.tgz#c308de734baaed8ed8316dc8501a82a0ced674f4"

0 commit comments

Comments
 (0)