Skip to content

Commit

Permalink
Change to Rollup.js
Browse files Browse the repository at this point in the history
  • Loading branch information
barcia committed Feb 21, 2019
1 parent 3626711 commit b777761
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 79 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md → CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Changelog
## [1.2.0](https://github.com/barcia/swibe/releases/tag/1.2.0) - 2019-02-21
### Changed
- Changed [WebPack](https://webpack.js.org) bundler to [Rollup](https://rollupjs.org/)
- Remove extension from some markdown files
- Update README
### Fixed
- Small bug in IE11 that not return body scroll after close menu

## [1.1.0](https://github.com/barcia/swibe/releases/tag/1.1.0) - 2019-01-16
### Added
- Option to add Swibe as script
Expand Down
63 changes: 32 additions & 31 deletions README.md → README
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,25 @@ A simple slide menu in JS
- [Web](http://barcia.github.io/standarize)
- [Repository](https://github.com/barcia/standarize)
- [Issues](https://github.com/barcia/standarize/issues)
- [Changelog](https://github.com/barcia/swibe/blob/master/CHANGELOG.md)
- [Changelog](https://github.com/barcia/swibe/blob/master/CHANGELOG)


## Getting Started

### Script
1. [Download the last release](https://github.com/barcia/swibe/releases/latest):
```html
<!-- Downloaded file -->
<script src="swibe.min.js"></script>
### 1. Load Swibe

<!-- With UNPKG -->
<script src="https://unpkg.com/swibe"></script>
```
#### Script
```html
<!-- Downloaded file -->
<script src="swibe.min.js"></script>

2. Start a Swibe menu instace with
```js
new Swibe.default();
<!-- With UNPKG -->
<script src="https://unpkg.com/swibe"></script>
```

### Module
> [Download the last release](https://github.com/barcia/swibe/releases/latest)

#### Module
1. Install it with [npm](https://www.npmjs.com/package/swibe):

```js
Expand All @@ -37,35 +34,39 @@ new Swibe.default();

2. Import *swibe.min.js* in your code.
```js
import Swibe from './swibe.min.js';
import Swibe from 'swibe';
```

3. Start a Swibe menu instace with


## 2. Start a instace
Start a Swibe menu instace with:

```js
new Swibe();
```


(See [config](https://github.com/barcia/swibe#configuration))
> See [config](https://github.com/barcia/swibe#configuration)


- Add a **trigger** and a **menu** items
```html
<button id="swibe-menu-trigger">Menu</button>
```
Add a **trigger** and a **menu** items
```html
<button id="swibe-menu-trigger">Menu</button>
```

```html
<nav id="swibe-menu">
<ul>
<li><a>Item</a></li>
<li><a>Item</a></li>
<li><a>Item</a></li>
<li><a>Item</a></li>
</ul>
</nav>
```
```html
<nav id="swibe-menu">
<ul>
<li><a>Item</a></li>
<li><a>Item</a></li>
<li><a>Item</a></li>
<li><a>Item</a></li>
</ul>
</nav>
```

> You can see this example working in [demo.html](https://github.com/barcia/swibe/blob/master/docs/demo/index.html)
> You can see this example working in [demo.html](https://github.com/barcia/swibe/blob/master/docs/demo/index.html)



Expand Down
3 changes: 1 addition & 2 deletions dist/swibe.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<!-- <script src="swibe.min.js"></script> -->
<script src="https://unpkg.com/swibe"></script>
<script>
new Swibe.default();
new Swibe();
</script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@

<nav class="nav">
<ul>
<li><a href="https://github.com/barcia/swibe/blob/master/README.md" title="Documentation">Docs</a></li>
<li><a href="https://github.com/barcia/swibe/blob/master/README" title="Documentation">Docs</a></li>
<li><a href="https://github.com/barcia/swibe" title="View code on GitHub">Code</a></li>
</ul>
</nav>
Expand Down
26 changes: 11 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
{
"name": "swibe",
"version": "1.1.0",
"version": "1.2.0",
"license": "MIT",
"description": "A simple swipe menu",
"homepage": "http://barcia.github.io/swibe",
"repository": "https://github.com/barcia/swibe",
"bugs": "https://github.com/barcia/swibe/issues",
"author": {
"name": "Iván Barcia",
"email": "[email protected]",
"url": "https://barcia.gal"
},
"author": "Iván Barcia <[email protected]> (https://barcia.gal)",
"browser": "dist/swibe.min.js",
"files": [
"dist"
],
"scripts": {
"build": "webpack --mode production",
"watch": "webpack --mode development --watch",
"start": "webpack-dev-server --mode development"
"build": "rollup -c",
"start": "rollup -c --watch",
"prepare": "npm run build"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/core": "^7.3.3",
"@babel/plugin-transform-object-assign": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"babel-loader": "^8.0.5",
"webpack": "^4.28.4",
"webpack-cli": "^3.2.1",
"webpack-dev-server": "^3.1.14"
"@babel/preset-env": "^7.3.1",
"rollup": "^1.2.2",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-terser": "^4.0.4"
},
"keywords": [
"js",
Expand All @@ -36,6 +31,7 @@
"slide",
"swipe",
"swibe",
"responsive",
"bramework"
]
}
19 changes: 19 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import babel from 'rollup-plugin-babel';
import { terser } from "rollup-plugin-terser";

const isProduction = process.env.BUILD === 'production';

module.exports = {
input: 'src/swibe.js',
output: {
name: 'Swibe',
file: 'dist/swibe.min.js',
format: 'umd'
},
plugins: [
babel({
exclude: 'node_modules/**' // only transpile our source code
}),
terser()
]
};
2 changes: 1 addition & 1 deletion src/swibe.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Swibe 1.1.0
* Swibe 1.2.0
* MIT License
* https://github.com/barcia/swibe
*/
Expand Down
28 changes: 0 additions & 28 deletions webpack.config.js

This file was deleted.

0 comments on commit b777761

Please sign in to comment.