Added CDN references
This commit is contained in:
parent
4314853640
commit
880152d0a0
@ -1,6 +1,5 @@
|
||||
{
|
||||
"name": "plyr",
|
||||
"version": "1.0.17",
|
||||
"description": "A simple HTML5 media player using custom controls",
|
||||
"homepage": "http://plyr.io",
|
||||
"keywords": [
|
||||
@ -14,10 +13,11 @@
|
||||
],
|
||||
"dependencies": {},
|
||||
"main": [
|
||||
"dist/css/plyr.css",
|
||||
"dist/js/plyr.js",
|
||||
"dist/plyr.css",
|
||||
"dist/plyr.js",
|
||||
"dist/sprite.svg",
|
||||
"src/less/plyr.less",
|
||||
"src/sass/plyr.sass",
|
||||
"src/js/plyr.js"
|
||||
],
|
||||
"ignore": [
|
||||
|
@ -17,7 +17,7 @@
|
||||
"js": {
|
||||
"docs.js": [
|
||||
"docs/src/js/lib/hogan-3.0.2.mustache.js",
|
||||
"docs/dist/js/templates.js",
|
||||
"docs/dist/templates.js",
|
||||
"docs/src/js/docs.js"
|
||||
]
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## v1.0.7
|
||||
## v1.0.18
|
||||
- Added CDN references
|
||||
|
||||
## v1.0.17
|
||||
- SASS support added (thanks to @brunowego)
|
||||
- Docs completely seperated to avoid any confusion
|
||||
- New gulp tasks (will add more documentation for this)
|
||||
|
2
docs/dist/docs.js
vendored
2
docs/dist/docs.js
vendored
File diff suppressed because one or more lines are too long
@ -8,10 +8,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" href="plyr/css/plyr.css">
|
||||
<link rel="stylesheet" href="//cdn.plyr.io/1.0.17/plyr.css">
|
||||
|
||||
<!-- Docs styles -->
|
||||
<link rel="stylesheet" href="dist/css/docs.css">
|
||||
<link rel="stylesheet" href="//cdn.plyr.io/1.0.17/docs.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
@ -67,13 +67,13 @@
|
||||
<!-- Load SVG defs -->
|
||||
<!-- You should bundle all SVG/Icons into one file using a build tool such as gulp and svg store -->
|
||||
<script>
|
||||
(function(d,p){var a=new XMLHttpRequest(),b=d.body;a.open("GET",p,!0);a.send();a.onload=function(){var c=d.createElement("div");c.style.display="none";c.innerHTML=a.responseText;b.insertBefore(c,b.childNodes[0])}})(document,"plyr/sprite.svg");
|
||||
(function(d,p){var a=new XMLHttpRequest(),b=d.body;a.open("GET",p,!0);a.send();a.onload=function(){var c=d.createElement("div");c.style.display="none";c.innerHTML=a.responseText;b.insertBefore(c,b.childNodes[0])}})(document,"//cdn.plyr.io/1.0.17/sprite.svg");
|
||||
</script>
|
||||
|
||||
<!-- Plyr core script -->
|
||||
<script src="plyr/js/plyr.js"></script>
|
||||
<script src="//cdn.plyr.io/1.0.17/plyr.js"></script>
|
||||
|
||||
<!-- Docs script -->
|
||||
<script src="dist/js/docs.js"></script>
|
||||
<script src="//cdn.plyr.io/1.0.17/docs.js"></script>
|
||||
</body>
|
||||
</html>
|
79
gulpfile.js
79
gulpfile.js
@ -19,10 +19,11 @@ var fs = require("fs"),
|
||||
hogan = require("gulp-hogan-compile"),
|
||||
rename = require("gulp-rename"),
|
||||
s3 = require("gulp-s3"),
|
||||
gzip = require("gulp-gzip");
|
||||
gzip = require("gulp-gzip"),
|
||||
replace = require("gulp-replace");
|
||||
|
||||
var root = __dirname,
|
||||
paths = {
|
||||
paths = {
|
||||
plyr: {
|
||||
// Source paths
|
||||
src: {
|
||||
@ -32,7 +33,7 @@ var root = __dirname,
|
||||
sprite: path.join(root, "src/sprite/*.svg")
|
||||
},
|
||||
// Output paths
|
||||
output: path.join(root, "dist/")
|
||||
output: path.join(root, "dist/")
|
||||
},
|
||||
docs: {
|
||||
// Source paths
|
||||
@ -42,8 +43,11 @@ var root = __dirname,
|
||||
templates: path.join(root, "docs/src/templates/*.html")
|
||||
},
|
||||
// Output paths
|
||||
output: path.join(root, "docs/dist/")
|
||||
}
|
||||
output: path.join(root, "docs/dist/"),
|
||||
// Docs
|
||||
root: path.join(root, "docs/")
|
||||
},
|
||||
upload: [path.join(root, "dist/**"), path.join(root, "docs/dist/**")]
|
||||
},
|
||||
|
||||
// Task arrays
|
||||
@ -187,32 +191,53 @@ gulp.task("watch", function () {
|
||||
});
|
||||
|
||||
// Publish the docs site
|
||||
try {
|
||||
var aws = loadJSON(path.join(root, "aws.json"));
|
||||
}
|
||||
catch (e) { }
|
||||
|
||||
var version = package.version,
|
||||
maxAge = 31536000, // seconds 1 year
|
||||
options = {
|
||||
cdn: {
|
||||
headers: {
|
||||
"Cache-Control": "max-age=" + maxAge + ", no-transform, public",
|
||||
"Vary": "Accept-Encoding"
|
||||
},
|
||||
gzippedOnly: true
|
||||
},
|
||||
docs: {
|
||||
headers: {
|
||||
"Cache-Control": "public, must-revalidate, proxy-revalidate, max-age=0",
|
||||
"Vary": "Accept-Encoding"
|
||||
},
|
||||
gzippedOnly: true
|
||||
}
|
||||
},
|
||||
cdnpath = new RegExp(aws.cdn.bucket + "\/(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)","gi");
|
||||
|
||||
gulp.task("cdn", function () {
|
||||
try {
|
||||
var aws = loadJSON(path.join(root, "aws.json")),
|
||||
version = package.version,
|
||||
maxAge = 31536000, // seconds 1 year
|
||||
options = {
|
||||
headers: {
|
||||
"Cache-Control": "max-age=" + maxAge + ", no-transform, public",
|
||||
"Content-Encoding": "gzip",
|
||||
"Vary": "Accept-Encoding"
|
||||
},
|
||||
gzippedOnly: true
|
||||
};
|
||||
console.log("Uploading " + version + " to " + aws.cdn.bucket);
|
||||
|
||||
console.log("Publishing " + version);
|
||||
// Upload to CDN
|
||||
gulp.src(paths.upload)
|
||||
.pipe(rename(function (path) {
|
||||
path.dirname = path.dirname.replace(".", version);
|
||||
}))
|
||||
.pipe(gzip())
|
||||
.pipe(s3(aws.cdn, options.cdn));
|
||||
});
|
||||
|
||||
return gulp.src("dist/**")
|
||||
.pipe(rename(function (path) {
|
||||
path.dirname = path.dirname.replace(".", version);
|
||||
}))
|
||||
.pipe(gzip())
|
||||
.pipe(s3(aws, options));
|
||||
}
|
||||
catch (e) {}
|
||||
gulp.task("docs", function () {
|
||||
console.log("Uploading " + version + " docs to " + aws.docs.bucket);
|
||||
|
||||
// Replace versioned files in index.html
|
||||
gulp.src([paths.docs.root + "index.html"])
|
||||
.pipe(replace(cdnpath, aws.cdn.bucket + "/" + version))
|
||||
.pipe(gzip())
|
||||
.pipe(s3(aws.docs, options.docs));
|
||||
});
|
||||
|
||||
gulp.task("publish", function () {
|
||||
|
||||
run("templates", tasks.js, tasks.less, "sprite", "cdn", "docs");
|
||||
});
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "plyr",
|
||||
"version": "1.0.17",
|
||||
"version": "1.0.18",
|
||||
"description": "A simple HTML5 media player using custom controls",
|
||||
"homepage": "http://plyr.io",
|
||||
"main": "gulpfile.js",
|
||||
@ -14,6 +14,7 @@
|
||||
"gulp-less": "~1.3.1",
|
||||
"gulp-minify-css": "~0.3.6",
|
||||
"gulp-rename": "^1.2.0",
|
||||
"gulp-replace": "^0.5.3",
|
||||
"gulp-s3": "^0.3.0",
|
||||
"gulp-sass": "^1.3.3",
|
||||
"gulp-svgmin": "^1.0.0",
|
||||
|
10
readme.md
10
readme.md
@ -39,6 +39,16 @@ bower install plyr
|
||||
```
|
||||
More info on setting up dependencies can be found in the [Bower Docs](http://bower.io/docs/creating-packages/#maintaining-dependencies)
|
||||
|
||||
### CDN
|
||||
If you want to use our CDN, you can use the following. Currently it's HTTP only.
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="http://cdn.plyr.io/1.0.18/plyr.css">
|
||||
<script src="http://cdn.plyr.io/1.0.18/plyr.js"></script>
|
||||
```
|
||||
|
||||
You can also access the `sprite.svg` file at `http://cdn.plyr.io/1.0.18/sprite.svg`.
|
||||
|
||||
### CSS
|
||||
If you want to use the default css, add the `plyr.css` file from /dist into your head, or even better use `plyr.less` or `plyr.sass` file included in `/src` in your build to save a request.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user