Skip to content

Commit

Permalink
📝 Display bundle size badge
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoLegends committed Feb 26, 2018
1 parent 9cc4a08 commit ea629b3
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
node_modules/
.rpt2_cache/
.rpt2_cache/
.tmp/
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea/
.rpt2_cache/

.editorconfig
.travis.yml
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# 💪 fit-html

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

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

## Overview

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.
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.

## Small Example

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

MIT

<sup>1</sup>: fit-html weighs in at about 3.2kb right now
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fit-html",
"version": "0.5.1",
"version": "0.5.2",
"description": "5KB functional Web Components without bloat",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -10,12 +10,8 @@
"private": false,
"bundlesize": [
{
"path": "dist/bundle.min.js",
"maxSize": "2 kb"
},
{
"path": "dist/bundle+deps.min.js",
"maxSize": "5 kb"
"path": ".tmp/index.min.js",
"maxSize": "3 kb"
}
],
"devDependencies": {
Expand All @@ -25,6 +21,7 @@
"rollup-plugin-babel-minify": "^4.0.0",
"rollup-plugin-commonjs": "^8.3.0",
"rollup-plugin-node-resolve": "^3.0.3",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-typescript2": "^0.11.1",
"tslint": "^5.9.1",
"typescript": "^2.5.3"
Expand All @@ -34,8 +31,8 @@
"redux": "^3.7.2"
},
"scripts": {
"build": "yarn lint && tsc",
"check-size": "rollup -c && bundlesize && rm dist/bundle*",
"build": "yarn lint && tsc && NODE_ENV=production rollup -c",
"check-size": "yarn build && bundlesize",
"fix": "tslint -p tsconfig.json --fix",
"lint": "tslint -p tsconfig.json"
}
Expand Down
25 changes: 9 additions & 16 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
import minify from 'rollup-plugin-babel-minify';
import cjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
import typescript from 'rollup-plugin-typescript2';

export default [{
export default {
input: 'src/index.ts',
output: {
file: 'dist/bundle.min.js',
format: 'es',
sourcemap: false,
},
plugins: [ // No nodeResolve here to avoid bundling dependencies
typescript(),
cjs(),
minify({ comments: false }),
],
}, {
input: 'src/index.ts',
output: {
file: 'dist/bundle+deps.min.js',
format: 'es',
file: '.tmp/index.min.js',
format: 'umd',
name: 'FitHtml',
sourcemap: false,
},
plugins: [
nodeResolve({ browser: true }),
typescript(),
cjs(),
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'develop'),
}),
minify({ comments: false }),
],
}];
};
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,14 @@ rollup-plugin-node-resolve@^3.0.3:
is-module "^1.0.0"
resolve "^1.1.6"

rollup-plugin-replace@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-replace/-/rollup-plugin-replace-2.0.0.tgz#19074089c8ed57184b8cc64e967a03d095119277"
dependencies:
magic-string "^0.22.4"
minimatch "^3.0.2"
rollup-pluginutils "^2.0.1"

rollup-plugin-typescript2@^0.11.1:
version "0.11.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.11.1.tgz#c308de734baaed8ed8316dc8501a82a0ced674f4"
Expand Down

0 comments on commit ea629b3

Please sign in to comment.