Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
* Added rollup.polyfill.js for better polyfill management
* Updated the rollup.config.js
* Version Bump
  • Loading branch information
thednp committed Jun 19, 2020
1 parent 5ddd6c9 commit 2f8613a
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 107 deletions.
2 changes: 1 addition & 1 deletion demo/src/js/navbar.min.js

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

90 changes: 0 additions & 90 deletions demo/src/js/polyfill.js

This file was deleted.

5 changes: 3 additions & 2 deletions demo/src/js/polyfill.min.js

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

2 changes: 1 addition & 1 deletion dist/js/navbar.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Navbar.js v2.0.6 (http://thednp.github.io/navbar.js)
* Navbar.js v2.0.7 (http://thednp.github.io/navbar.js)
* Copyright 2016-2020 © thednp
* Licensed under MIT (https://github.com/thednp/navbar.js/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/js/navbar.esm.min.js

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

2 changes: 1 addition & 1 deletion dist/js/navbar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Navbar.js v2.0.6 (http://thednp.github.io/navbar.js)
* Navbar.js v2.0.7 (http://thednp.github.io/navbar.js)
* Copyright 2016-2020 © thednp
* Licensed under MIT (https://github.com/thednp/navbar.js/blob/master/LICENSE)
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/js/navbar.min.js

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

5 changes: 5 additions & 0 deletions dist/js/polyfill.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*!
* Navbar.js v2.0.7 (http://thednp.github.io/navbar.js)
* Copyright 2016-2020 © thednp
* Licensed under MIT (https://github.com/thednp/navbar.js/blob/master/LICENSE)
*/
"use strict";
if (!Array.from) {
Array.from = (function () {
Expand Down
1 change: 1 addition & 0 deletions dist/js/polyfill.min.js

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

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "navbar.js",
"version": "2.0.6",
"version": "2.0.7",
"description": "Navbar.js Modern Navigation Component",
"main": "dist/js/navbar.min.js",
"module": "dist/js/navbar.esm.js",
Expand Down Expand Up @@ -30,9 +30,10 @@
"compile-left-menu": "node compile.js INPUTFILE:src/scss/left-menu.scss OUTPUTFILE:demo/src/css/navbar-left-menu.min.css MIN:true",
"compile-right": "node compile.js INPUTFILE:src/scss/right.scss OUTPUTFILE:demo/src/css/navbar-right.min.css MIN:true",
"copy-compile": "node compile.js INPUTFILE:dist/css/navbar.min.css OUTPUTFILE:demo/src/css/navbar.min.css COPY:true",
"polyfill": "npm-run-all --parallel pln plnm",
"pln": "rollup --environment FORMAT:esm,MIN:false,POLYFILL:true -c",
"plnm": "rollup --environment FORMAT:esm,MIN:true,POLYFILL:true -c"
"polyfill": "npm-run-all --parallel polyfill-unminified polyfill-minified && npm run copy-polyfill",
"polyfill-unminified": "rollup --environment MIN:false -c rollup.polyfill.js",
"polyfill-minified": "rollup --environment MIN:true -c rollup.polyfill.js",
"copy-polyfill": "node compile.js INPUTFILE:dist/js/polyfill.min.js OUTPUTFILE:demo/src/js/polyfill.min.js COPY:true"
},
"repository": {
"type": "git",
Expand Down
10 changes: 4 additions & 6 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@ import cleanup from 'rollup-plugin-cleanup';
import json from '@rollup/plugin-json';
import * as pkg from "./package.json";

const POLYFILL = process.env.POLYFILL === 'true'
const MIN = process.env.MIN === 'true' || false; // true/false|unset
const FORMAT = process.env.FORMAT; // JS umd|iife|esm

const year = (new Date).getFullYear();

const banner = POLYFILL ? '"use strict";':
const banner =
`/*!
* Navbar.js v${pkg.version} (${pkg.homepage})
* Copyright 2016-${year} © ${pkg.author}
* Licensed under MIT (https://github.com/thednp/navbar.js/blob/master/LICENSE)
*/`;

const miniBannerJS = POLYFILL ? banner
: `// Navbar.js v${pkg.version} | ${pkg.author} © ${year} | ${pkg.license}-License`;
const miniBannerJS = `// Navbar.js v${pkg.version} | ${pkg.author} © ${year} | ${pkg.license}-License`;

const INPUTFILE = POLYFILL ? 'src/js/polyfill.js' : 'src/js/index.js';
const OUTPUTFILE = POLYFILL ? 'dist/js/polyfill'+(MIN?'.min':'')+'.js' : 'dist/js/navbar'+(FORMAT==='esm'?'.esm':'')+(MIN?'.min':'')+'.js';
const INPUTFILE = 'src/js/index.js';
const OUTPUTFILE = 'dist/js/navbar'+(FORMAT!=='umd'?'.'+FORMAT:'')+(MIN?'.min':'')+'.js';

const OUTPUT = {
file: OUTPUTFILE,
Expand Down
Loading

0 comments on commit 2f8613a

Please sign in to comment.