Add Webpack example

This commit is contained in:
Jordan Eldredge 2018-03-29 06:52:44 -07:00
parent c54aed1efe
commit 96407ccb4b
7 changed files with 52449 additions and 0 deletions

View file

@ -7,6 +7,9 @@ Here's how to use Winamp-js in your own project.
If you would like to look as some examples check out the [examples directory](../examples/) were you will find:
* [Minimal](../examples/minimal/) - An example that just uses a `<script>` tag that points to a CDN. No install required.
* [Webpack](../examples/webpack/) - An example that installs Winamp2-js via NPM, and bundles it into an applicaiton using Webpack.
Each example has a README which explains it in more detail.
## Install

View file

@ -0,0 +1,13 @@
# Minimal Example
This example includes Winamp2-js in a Webpack bundle. The audio file and skin are fetched from a free CDN at run time.
To try it out:
```
$ git clone git@github.com:captbaritone/winamp2-js.git
$ cd winamp2-js/examples/webpack/
$ npm install
$ npm run build
$ open index.html
```

41936
examples/webpack/bundle.js Normal file

File diff suppressed because one or more lines are too long

13
examples/webpack/index.html Executable file
View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id='app'></div>
<script src="./bundle.js"></script>
</body>
</html>

18
examples/webpack/index.js Normal file
View file

@ -0,0 +1,18 @@
import Winamp from "winamp2-js";
new Winamp({
initialTracks: [
{
metaData: {
artist: "DJ Mike Llama",
title: "Llama Whippin' Intro"
},
url:
"https://cdn.rawgit.com/captbaritone/winamp2-js/43434d82/mp3/llama-2.91.mp3"
}
],
initialSkin: {
url:
"https://cdn.rawgit.com/captbaritone/winamp2-js/43434d82/skins/base-2.91.wsz"
}
}).renderWhenReady(document.getElementById("app"));

10451
examples/webpack/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
{
"name": "winamp2-js-webpack-example",
"version": "0.0.0",
"description": "An example of using Winamp2-js within a Webpack bundle",
"main": "index.js",
"scripts": {
"build": "webpack index.js bundle.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"webpack-cli": "^2.0.13",
"winamp2-js": "0.0.6"
}
}