mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-25 02:57:30 +00:00
Add Webpack example
This commit is contained in:
parent
c54aed1efe
commit
96407ccb4b
7 changed files with 52449 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
13
examples/webpack/README.md
Normal file
13
examples/webpack/README.md
Normal 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
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
13
examples/webpack/index.html
Executable 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
18
examples/webpack/index.js
Normal 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
10451
examples/webpack/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
15
examples/webpack/package.json
Normal file
15
examples/webpack/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue