Skip to content

Commit

Permalink
fix(config): modified config elements to create bundles correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rafa8626 committed May 17, 2018
1 parent 003abc7 commit 81941cb
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 18 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
node_modules/
dist/
.vscode/
ts-dist/
.idea/
coverage/
docs/
coverage/
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ Inspired by [MediaElementJS](http://mediaelementjs.com) and [Plyr](https://plyr.

### Obtain the files

Currently, no `dist` folder or CDN reference is available. With the following steps, the `dist` folder and the bundles will be generated:
The `dist` folder contains the files you will need yo use this awesome library. To obtain it, you can use one of the following methods:

#### Direct download
Download the repository from `https://github.com/rafa8626/openplayer.git`

#### NPM
```
git clone https://github.com/rafa8626/openplayer.git
cd openplayer
npm install
npm run build
npm install openplayer
```

### HTML
Expand All @@ -40,13 +41,23 @@ Include the OpenPlayer stylesheet inside the `<head>` tag, and the script at the
#### Stylesheet

```html
<link rel="stylesheet" href="/path/to/om_player.css">
<link rel="stylesheet" href="/path/to/openplayer.css">
```

#### Script

```html
<script src="/path/to/om_player.js"></script>
<script src="/path/to/openplayer.js"></script>
```

If you plan to use the library in a Node project:

```javascript
// Using as module
var openplayer = require('/path/to/openplayer');

// Importing library
import OpenPlayer from 'openplayer';
```

### Minimal example
Expand Down
4 changes: 2 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="../dist/om_player.css">
<link rel="stylesheet" href="../dist/openplayer.css">
<style>
body {
max-width: 700px;
Expand Down Expand Up @@ -59,7 +59,7 @@ <h1>Audio Sample</h1>
</div>
</div>

<script src="../dist/om_player.js"></script>
<script src="../dist/openplayer.js"></script>
<script>
var sourcesSelector = document.querySelectorAll('select[name=sources]');
var destroyBtn = document.querySelectorAll('button.destroy-player');
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"declaration": false,
"allowJs": true,
"target": "es6",
"module": "es6",
"module": "commonjs",
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": false,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": false,
"skipLibCheck": true,
Expand Down
12 changes: 8 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ const UnminifiedWebpackPlugin = require('unminified-webpack-plugin');
module.exports = {
context: __dirname,
entry: {
'om_player.min.js': './src/js/player.ts',
'om_player.css': './src/css/player.css',
'om_player.min.css': './src/css/player.css',
'openplayer.min.js': './src/js/player.ts',
'openplayer.css': './src/css/player.css',
'openplayer.min.css': './src/css/player.css',
},
output: {
path: path.resolve(__dirname, './dist'),
filename: '[name]'
filename: '[name]',
publicPath: '/dist/',
library: 'OpenPlayer',
libraryTarget: 'umd',
libraryExport: 'default'
},
module: {
rules: [
Expand Down

0 comments on commit 81941cb

Please sign in to comment.