From 431485364067790331fc3a604fe0fa02c247cbb2 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Sun, 1 Mar 2015 23:23:08 +1100 Subject: [PATCH] Publishing to AWS --- .gitignore | 1 + dist/{css => }/plyr.css | 0 dist/{js => }/plyr.js | 0 docs/dist/{css => }/docs.css | 0 docs/dist/docs.js | 1 + docs/dist/js/docs.js | 1 - docs/dist/{js => }/templates.js | 0 docs/index.html | 6 +-- gulpfile.js | 88 ++++++++++++++++++++++----------- package.json | 3 ++ readme.md | 8 +-- 11 files changed, 70 insertions(+), 38 deletions(-) rename dist/{css => }/plyr.css (100%) rename dist/{js => }/plyr.js (100%) rename docs/dist/{css => }/docs.css (100%) create mode 100644 docs/dist/docs.js delete mode 100644 docs/dist/js/docs.js rename docs/dist/{js => }/templates.js (100%) diff --git a/.gitignore b/.gitignore index 67096efd..17360527 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules *.sublime-project *.sublime-workspace .DS_Store +aws.json diff --git a/dist/css/plyr.css b/dist/plyr.css similarity index 100% rename from dist/css/plyr.css rename to dist/plyr.css diff --git a/dist/js/plyr.js b/dist/plyr.js similarity index 100% rename from dist/js/plyr.js rename to dist/plyr.js diff --git a/docs/dist/css/docs.css b/docs/dist/docs.css similarity index 100% rename from docs/dist/css/docs.css rename to docs/dist/docs.css diff --git a/docs/dist/docs.js b/docs/dist/docs.js new file mode 100644 index 00000000..0c51385e --- /dev/null +++ b/docs/dist/docs.js @@ -0,0 +1 @@ +var Hogan={};!function(t){function n(t,n,e){var r;return n&&"object"==typeof n&&(void 0!==n[t]?r=n[t]:e&&n.get&&"function"==typeof n.get&&(r=n.get(t))),r}function e(t,n,e,r,i,a){function s(){}function o(){}s.prototype=t,o.prototype=t.subs;var c,u=new s;u.subs=new o,u.subsText={},u.buf="",r=r||{},u.stackSubs=r,u.subsText=a;for(c in n)r[c]||(r[c]=n[c]);for(c in r)u.subs[c]=r[c];i=i||{},u.stackPartials=i;for(c in e)i[c]||(i[c]=e[c]);for(c in i)u.partials[c]=i[c];return u}function r(t){return String(null===t||void 0===t?"":t)}function i(t){return t=r(t),l.test(t)?t.replace(a,"&").replace(s,"<").replace(o,">").replace(c,"'").replace(u,"""):t}t.Template=function(t,n,e,r){t=t||{},this.r=t.code||this.r,this.c=e,this.options=r||{},this.text=n||"",this.partials=t.partials||{},this.subs=t.subs||{},this.buf=""},t.Template.prototype={r:function(){return""},v:i,t:r,render:function(t,n,e){return this.ri([t],n||{},e)},ri:function(t,n,e){return this.r(t,n,e)},ep:function(t,n){var r=this.partials[t],i=n[r.name];if(r.instance&&r.base==i)return r.instance;if("string"==typeof i){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}if(!i)return null;if(this.partials[t].base=i,r.subs){n.stackText||(n.stackText={});for(key in r.subs)n.stackText[key]||(n.stackText[key]=void 0!==this.activeSub&&n.stackText[this.activeSub]?n.stackText[this.activeSub]:this.text);i=e(i,r.subs,r.partials,this.stackSubs,this.stackPartials,n.stackText)}return this.partials[t].instance=i,i},rp:function(t,n,e,r){var i=this.ep(t,e);return i?i.ri(n,e,r):""},rs:function(t,n,e){var r=t[t.length-1];if(!f(r))return e(t,n,this),void 0;for(var i=0;i=0;u--)if(s=e[u],a=n(t,s,c),void 0!==a){o=!0;break}return o?(i||"function"!=typeof a||(a=this.mv(a,e,r)),a):i?!1:""},ls:function(t,n,e,i,a){var s=this.options.delimiters;return this.options.delimiters=a,this.b(this.ct(r(t.call(n,i)),n,e)),this.options.delimiters=s,!1},ct:function(t,n,e){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(t,this.options).render(n,e)},b:function(t){this.buf+=t},fl:function(){var t=this.buf;return this.buf="",t},ms:function(t,n,e,r,i,a,s){var o,c=n[n.length-1],u=t.call(c);return"function"==typeof u?r?!0:(o=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(u,c,e,o.substring(i,a),s)):u},mv:function(t,n,e){var i=n[n.length-1],a=t.call(i);return"function"==typeof a?this.ct(r(a.call(i)),i,e):a},sub:function(t,n,e,r){var i=this.subs[t];i&&(this.activeSub=t,i(n,e,this,r),this.activeSub=!1)}};var a=/&/g,s=//g,c=/\'/g,u=/\"/g,l=/[&<>\"\']/,f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}}("undefined"!=typeof exports?exports:Hogan),function(t){function n(t){"}"===t.n.substr(t.n.length-1)&&(t.n=t.n.substring(0,t.n.length-1))}function e(t){return t.trim?t.trim():t.replace(/^\s*|\s*$/g,"")}function r(t,n,e){if(n.charAt(e)!=t.charAt(0))return!1;for(var r=1,i=t.length;i>r;r++)if(n.charAt(e+r)!=t.charAt(r))return!1;return!0}function i(n,e,r,o){var c=[],u=null,l=null,f=null;for(l=r[r.length-1];n.length>0;){if(f=n.shift(),l&&"<"==l.tag&&!(f.tag in x))throw new Error("Illegal content in < super tag.");if(t.tags[f.tag]<=t.tags.$||a(f,o))r.push(f),f.nodes=i(n,f.tag,r,o);else{if("/"==f.tag){if(0===r.length)throw new Error("Closing tag without opener: /"+f.n);if(u=r.pop(),f.n!=u.n&&!s(f.n,u.n,o))throw new Error("Nesting error: "+u.n+" vs. "+f.n);return u.end=f.i,c}"\n"==f.tag&&(f.last=0==n.length||"\n"==n[0].tag)}c.push(f)}if(r.length>0)throw new Error("missing closing tag: "+r.pop().n);return c}function a(t,n){for(var e=0,r=n.length;r>e;e++)if(n[e].o==t.n)return t.tag="#",!0}function s(t,n,e){for(var r=0,i=e.length;i>r;r++)if(e[r].c==t&&e[r].o==n)return!0}function o(t){var n=[];for(var e in t)n.push('"'+u(e)+'": function(c,p,t,i) {'+t[e]+"}");return"{ "+n.join(",")+" }"}function c(t){var n=[];for(var e in t.partials)n.push('"'+u(e)+'":{name:"'+u(t.partials[e].name)+'", '+c(t.partials[e])+"}");return"partials: {"+n.join(",")+"}, subs: "+o(t.subs)}function u(t){return t.replace(m,"\\\\").replace(v,'\\"').replace(d,"\\n").replace(b,"\\r").replace(w,"\\u2028").replace(y,"\\u2029")}function l(t){return~t.indexOf(".")?"d":"f"}function f(t,n){var e="<"+(n.prefix||""),r=e+t.n+k++;return n.partials[r]={name:t.n,partials:{}},n.code+='t.b(t.rp("'+u(r)+'",c,p,"'+(t.indent||"")+'"));',r}function p(t,n){n.code+="t.b(t.t(t."+l(t.n)+'("'+u(t.n)+'",c,p,0)));'}function h(t){return"t.b("+t+");"}var g=/\S/,v=/\"/g,d=/\n/g,b=/\r/g,m=/\\/g,w=/\u2028/,y=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(i,a){function s(){m.length>0&&(w.push({tag:"_t",text:new String(m)}),m="")}function o(){for(var n=!0,e=k;e"==e.tag&&(e.indent=w[r].text.toString()),w.splice(r,1));else n||w.push({tag:"\n"});y=!1,k=w.length}function u(t,n){var r="="+S,i=t.indexOf(r,n),a=e(t.substring(t.indexOf("=",n)+1,i)).split(" ");return T=a[0],S=a[a.length-1],i+r.length-1}var l=i.length,f=0,p=1,h=2,v=f,d=null,b=null,m="",w=[],y=!1,x=0,k=0,T="{{",S="}}";for(a&&(a=a.split(" "),T=a[0],S=a[1]),x=0;l>x;x++)v==f?r(T,i,x)?(--x,s(),v=p):"\n"==i.charAt(x)?c(y):m+=i.charAt(x):v==p?(x+=T.length-1,b=t.tags[i.charAt(x+1)],d=b?i.charAt(x+1):"_v","="==d?(x=u(i,x),v=f):(b&&x++,v=h),y=x):r(S,i,x)?(w.push({tag:d,n:e(m),otag:T,ctag:S,i:"/"==d?y-T.length:x+S.length}),m="",x+=S.length-1,v=f,"{"==d&&("}}"==S?x++:n(w[w.length-1]))):m+=i.charAt(x);return c(y,!0),w};var x={_t:!0,"\n":!0,$:!0,"/":!0};t.stringify=function(n){return"{code: function (c,p,i) { "+t.wrapMain(n.code)+" },"+c(n)+"}"};var k=0;t.generate=function(n,e,r){k=0;var i={code:"",subs:{},partials:{}};return t.walk(n,i),r.asString?this.stringify(i,e,r):this.makeTemplate(i,e,r)},t.wrapMain=function(t){return'var t=this;t.b(i=i||"");'+t+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(t,n,e){var r=this.makePartials(t);return r.code=new Function("c","p","i",this.wrapMain(t.code)),new this.template(r,n,this,e)},t.makePartials=function(t){var n,e={subs:{},partials:t.partials,name:t.name};for(n in e.partials)e.partials[n]=this.makePartials(e.partials[n]);for(n in t.subs)e.subs[n]=new Function("c","p","t","i",t.subs[n]);return e},t.codegen={"#":function(n,e){e.code+="if(t.s(t."+l(n.n)+'("'+u(n.n)+'",c,p,1),c,p,0,'+n.i+","+n.end+',"'+n.otag+" "+n.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(n.nodes,e),e.code+="});c.pop();}"},"^":function(n,e){e.code+="if(!t.s(t."+l(n.n)+'("'+u(n.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(n.nodes,e),e.code+="};"},">":f,"<":function(n,e){var r={partials:{},code:"",subs:{},inPartial:!0};t.walk(n.nodes,r);var i=e.partials[f(n,e)];i.subs=r.subs,i.partials=r.partials},$:function(n,e){var r={subs:{},code:"",partials:e.partials,prefix:n.n};t.walk(n.nodes,r),e.subs[n.n]=r.code,e.inPartial||(e.code+='t.sub("'+u(n.n)+'",c,p,i);')},"\n":function(t,n){n.code+=h('"\\n"'+(t.last?"":" + i"))},_v:function(t,n){n.code+="t.b(t.v(t."+l(t.n)+'("'+u(t.n)+'",c,p,0)));'},_t:function(t,n){n.code+=h('"'+u(t.text)+'"')},"{":p,"&":p},t.walk=function(n,e){for(var r,i=0,a=n.length;a>i;i++)r=t.codegen[n[i].tag],r&&r(n[i],e);return e},t.parse=function(t,n,e){return e=e||{},i(t,"",[],e.sectionTags||[])},t.cache={},t.cacheKey=function(t,n){return[t,!!n.asString,!!n.disableLambda,n.delimiters,!!n.modelGet].join("||")},t.compile=function(n,e){e=e||{};var r=t.cacheKey(n,e),i=this.cache[r];if(i){var a=i.partials;for(var s in a)delete a[s].instance;return i}return i=this.generate(this.parse(this.scan(n,e.delimiters),n,e),n,e),this.cache[r]=i}}("undefined"!=typeof exports?exports:Hogan);var Mustache=function(t){function n(n,e,r,i){var a=this.f(n,e,r,0),s=e;return a&&(s=s.concat(a)),t.Template.prototype.rp.call(this,n,s,r,i)}var e=function(e,r,i){this.rp=n,t.Template.call(this,e,r,i)};e.prototype=t.Template.prototype;var r,i=function(){this.cache={},this.generate=function(t,n){return new e(new Function("c","p","i",t),n,r)}};return i.prototype=t,r=new i,{to_html:function(t,n,e,i){var a=r.compile(t),s=a.render(n,e);return i?(i(s),void 0):s}}}(Hogan);plyr.setup({debug:!0,title:"Video demo",html:templates.controls.render({}),captions:{defaultActive:!0}}),"plyr.io"===document.domain&&(!function(t,n,e,r,i,a,s){t.GoogleAnalyticsObject=i,t[i]=t[i]||function(){(t[i].q=t[i].q||[]).push(arguments)},t[i].l=1*new Date,a=n.createElement(e),s=n.getElementsByTagName(e)[0],a.async=1,a.src=r,s.parentNode.insertBefore(a,s)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-40881672-11","auto"),ga("send","pageview")); \ No newline at end of file diff --git a/docs/dist/js/docs.js b/docs/dist/js/docs.js deleted file mode 100644 index 7c72517b..00000000 --- a/docs/dist/js/docs.js +++ /dev/null @@ -1 +0,0 @@ -var Hogan={};!function(t){function n(t,n,e){var s;return n&&"object"==typeof n&&(void 0!==n[t]?s=n[t]:e&&n.get&&"function"==typeof n.get&&(s=n.get(t))),s}function e(t,n,e,s,a,r){function i(){}function o(){}i.prototype=t,o.prototype=t.subs;var l,u=new i;u.subs=new o,u.subsText={},u.buf="",s=s||{},u.stackSubs=s,u.subsText=r;for(l in n)s[l]||(s[l]=n[l]);for(l in s)u.subs[l]=s[l];a=a||{},u.stackPartials=a;for(l in e)a[l]||(a[l]=e[l]);for(l in a)u.partials[l]=a[l];return u}function s(t){return String(null===t||void 0===t?"":t)}function a(t){return t=s(t),c.test(t)?t.replace(r,"&").replace(i,"<").replace(o,">").replace(l,"'").replace(u,"""):t}t.Template=function(t,n,e,s){t=t||{},this.r=t.code||this.r,this.c=e,this.options=s||{},this.text=n||"",this.partials=t.partials||{},this.subs=t.subs||{},this.buf=""},t.Template.prototype={r:function(){return""},v:a,t:s,render:function(t,n,e){return this.ri([t],n||{},e)},ri:function(t,n,e){return this.r(t,n,e)},ep:function(t,n){var s=this.partials[t],a=n[s.name];if(s.instance&&s.base==a)return s.instance;if("string"==typeof a){if(!this.c)throw new Error("No compiler available.");a=this.c.compile(a,this.options)}if(!a)return null;if(this.partials[t].base=a,s.subs){n.stackText||(n.stackText={});for(key in s.subs)n.stackText[key]||(n.stackText[key]=void 0!==this.activeSub&&n.stackText[this.activeSub]?n.stackText[this.activeSub]:this.text);a=e(a,s.subs,s.partials,this.stackSubs,this.stackPartials,n.stackText)}return this.partials[t].instance=a,a},rp:function(t,n,e,s){var a=this.ep(t,e);return a?a.ri(n,e,s):""},rs:function(t,n,e){var s=t[t.length-1];if(!p(s))return e(t,n,this),void 0;for(var a=0;a=0;u--)if(i=e[u],r=n(t,i,l),void 0!==r){o=!0;break}return o?(a||"function"!=typeof r||(r=this.mv(r,e,s)),r):a?!1:""},ls:function(t,n,e,a,r){var i=this.options.delimiters;return this.options.delimiters=r,this.b(this.ct(s(t.call(n,a)),n,e)),this.options.delimiters=i,!1},ct:function(t,n,e){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(t,this.options).render(n,e)},b:function(t){this.buf+=t},fl:function(){var t=this.buf;return this.buf="",t},ms:function(t,n,e,s,a,r,i){var o,l=n[n.length-1],u=t.call(l);return"function"==typeof u?s?!0:(o=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(u,l,e,o.substring(a,r),i)):u},mv:function(t,n,e){var a=n[n.length-1],r=t.call(a);return"function"==typeof r?this.ct(s(r.call(a)),a,e):r},sub:function(t,n,e,s){var a=this.subs[t];a&&(this.activeSub=t,a(n,e,this,s),this.activeSub=!1)}};var r=/&/g,i=//g,l=/\'/g,u=/\"/g,c=/[&<>\"\']/,p=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}}("undefined"!=typeof exports?exports:Hogan),function(t){function n(t){"}"===t.n.substr(t.n.length-1)&&(t.n=t.n.substring(0,t.n.length-1))}function e(t){return t.trim?t.trim():t.replace(/^\s*|\s*$/g,"")}function s(t,n,e){if(n.charAt(e)!=t.charAt(0))return!1;for(var s=1,a=t.length;a>s;s++)if(n.charAt(e+s)!=t.charAt(s))return!1;return!0}function a(n,e,s,o){var l=[],u=null,c=null,p=null;for(c=s[s.length-1];n.length>0;){if(p=n.shift(),c&&"<"==c.tag&&!(p.tag in w))throw new Error("Illegal content in < super tag.");if(t.tags[p.tag]<=t.tags.$||r(p,o))s.push(p),p.nodes=a(n,p.tag,s,o);else{if("/"==p.tag){if(0===s.length)throw new Error("Closing tag without opener: /"+p.n);if(u=s.pop(),p.n!=u.n&&!i(p.n,u.n,o))throw new Error("Nesting error: "+u.n+" vs. "+p.n);return u.end=p.i,l}"\n"==p.tag&&(p.last=0==n.length||"\n"==n[0].tag)}l.push(p)}if(s.length>0)throw new Error("missing closing tag: "+s.pop().n);return l}function r(t,n){for(var e=0,s=n.length;s>e;e++)if(n[e].o==t.n)return t.tag="#",!0}function i(t,n,e){for(var s=0,a=e.length;a>s;s++)if(e[s].c==t&&e[s].o==n)return!0}function o(t){var n=[];for(var e in t)n.push('"'+u(e)+'": function(c,p,t,i) {'+t[e]+"}");return"{ "+n.join(",")+" }"}function l(t){var n=[];for(var e in t.partials)n.push('"'+u(e)+'":{name:"'+u(t.partials[e].name)+'", '+l(t.partials[e])+"}");return"partials: {"+n.join(",")+"}, subs: "+o(t.subs)}function u(t){return t.replace(m,"\\\\").replace(g,'\\"').replace(d,"\\n").replace(v,"\\r").replace(y,"\\u2028").replace(x,"\\u2029")}function c(t){return~t.indexOf(".")?"d":"f"}function p(t,n){var e="<"+(n.prefix||""),s=e+t.n+k++;return n.partials[s]={name:t.n,partials:{}},n.code+='t.b(t.rp("'+u(s)+'",c,p,"'+(t.indent||"")+'"));',s}function b(t,n){n.code+="t.b(t.t(t."+c(t.n)+'("'+u(t.n)+'",c,p,0)));'}function f(t){return"t.b("+t+");"}var h=/\S/,g=/\"/g,d=/\n/g,v=/\r/g,m=/\\/g,y=/\u2028/,x=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(a,r){function i(){m.length>0&&(y.push({tag:"_t",text:new String(m)}),m="")}function o(){for(var n=!0,e=k;e"==e.tag&&(e.indent=y[s].text.toString()),y.splice(s,1));else n||y.push({tag:"\n"});x=!1,k=y.length}function u(t,n){var s="="+S,a=t.indexOf(s,n),r=e(t.substring(t.indexOf("=",n)+1,a)).split(" ");return T=r[0],S=r[r.length-1],a+s.length-1}var c=a.length,p=0,b=1,f=2,g=p,d=null,v=null,m="",y=[],x=!1,w=0,k=0,T="{{",S="}}";for(r&&(r=r.split(" "),T=r[0],S=r[1]),w=0;c>w;w++)g==p?s(T,a,w)?(--w,i(),g=b):"\n"==a.charAt(w)?l(x):m+=a.charAt(w):g==b?(w+=T.length-1,v=t.tags[a.charAt(w+1)],d=v?a.charAt(w+1):"_v","="==d?(w=u(a,w),g=p):(v&&w++,g=f),x=w):s(S,a,w)?(y.push({tag:d,n:e(m),otag:T,ctag:S,i:"/"==d?x-T.length:w+S.length}),m="",w+=S.length-1,g=p,"{"==d&&("}}"==S?w++:n(y[y.length-1]))):m+=a.charAt(w);return l(x,!0),y};var w={_t:!0,"\n":!0,$:!0,"/":!0};t.stringify=function(n){return"{code: function (c,p,i) { "+t.wrapMain(n.code)+" },"+l(n)+"}"};var k=0;t.generate=function(n,e,s){k=0;var a={code:"",subs:{},partials:{}};return t.walk(n,a),s.asString?this.stringify(a,e,s):this.makeTemplate(a,e,s)},t.wrapMain=function(t){return'var t=this;t.b(i=i||"");'+t+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(t,n,e){var s=this.makePartials(t);return s.code=new Function("c","p","i",this.wrapMain(t.code)),new this.template(s,n,this,e)},t.makePartials=function(t){var n,e={subs:{},partials:t.partials,name:t.name};for(n in e.partials)e.partials[n]=this.makePartials(e.partials[n]);for(n in t.subs)e.subs[n]=new Function("c","p","t","i",t.subs[n]);return e},t.codegen={"#":function(n,e){e.code+="if(t.s(t."+c(n.n)+'("'+u(n.n)+'",c,p,1),c,p,0,'+n.i+","+n.end+',"'+n.otag+" "+n.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(n.nodes,e),e.code+="});c.pop();}"},"^":function(n,e){e.code+="if(!t.s(t."+c(n.n)+'("'+u(n.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(n.nodes,e),e.code+="};"},">":p,"<":function(n,e){var s={partials:{},code:"",subs:{},inPartial:!0};t.walk(n.nodes,s);var a=e.partials[p(n,e)];a.subs=s.subs,a.partials=s.partials},$:function(n,e){var s={subs:{},code:"",partials:e.partials,prefix:n.n};t.walk(n.nodes,s),e.subs[n.n]=s.code,e.inPartial||(e.code+='t.sub("'+u(n.n)+'",c,p,i);')},"\n":function(t,n){n.code+=f('"\\n"'+(t.last?"":" + i"))},_v:function(t,n){n.code+="t.b(t.v(t."+c(t.n)+'("'+u(t.n)+'",c,p,0)));'},_t:function(t,n){n.code+=f('"'+u(t.text)+'"')},"{":b,"&":b},t.walk=function(n,e){for(var s,a=0,r=n.length;r>a;a++)s=t.codegen[n[a].tag],s&&s(n[a],e);return e},t.parse=function(t,n,e){return e=e||{},a(t,"",[],e.sectionTags||[])},t.cache={},t.cacheKey=function(t,n){return[t,!!n.asString,!!n.disableLambda,n.delimiters,!!n.modelGet].join("||")},t.compile=function(n,e){e=e||{};var s=t.cacheKey(n,e),a=this.cache[s];if(a){var r=a.partials;for(var i in r)delete r[i].instance;return a}return a=this.generate(this.parse(this.scan(n,e.delimiters),n,e),n,e),this.cache[s]=a}}("undefined"!=typeof exports?exports:Hogan);var Mustache=function(t){function n(n,e,s,a){var r=this.f(n,e,s,0),i=e;return r&&(i=i.concat(r)),t.Template.prototype.rp.call(this,n,i,s,a)}var e=function(e,s,a){this.rp=n,t.Template.call(this,e,s,a)};e.prototype=t.Template.prototype;var s,a=function(){this.cache={},this.generate=function(t,n){return new e(new Function("c","p","i",t),n,s)}};return a.prototype=t,s=new a,{to_html:function(t,n,e,a){var r=s.compile(t),i=r.render(n,e);return a?(a(i),void 0):i}}}(Hogan),templates={};templates.controls=new Hogan.Template({code:function(t,n,e){var s=this;return s.b(e=e||""),s.b('
'),s.b("\n"+e),s.b('
'),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(" 0% played"),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(" 0% buffered"),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b("
"),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' Time'),s.b("\n"+e),s.b(' 00:00'),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' "),s.b("\n"),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' '),s.b("\n"),s.b("\n"+e),s.b(' '),s.b("\n"+e),s.b(' "),s.b("\n"),s.b("\n"+e),s.b(' "),s.b("\n"+e),s.b(" "),s.b("\n"+e),s.b("
"),s.fl()},partials:{},subs:{}}),plyr.setup({debug:!0,title:"Video demo",html:templates.controls.render({}),captions:{defaultActive:!0}}),"plyr.io"===document.domain&&(!function(t,n,e,s,a,r,i){t.GoogleAnalyticsObject=a,t[a]=t[a]||function(){(t[a].q=t[a].q||[]).push(arguments)},t[a].l=1*new Date,r=n.createElement(e),i=n.getElementsByTagName(e)[0],r.async=1,r.src=s,i.parentNode.insertBefore(r,i)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-40881672-11","auto"),ga("send","pageview")); \ No newline at end of file diff --git a/docs/dist/js/templates.js b/docs/dist/templates.js similarity index 100% rename from docs/dist/js/templates.js rename to docs/dist/templates.js diff --git a/docs/index.html b/docs/index.html index 5a9ae5fc..7b69f784 100644 --- a/docs/index.html +++ b/docs/index.html @@ -8,7 +8,7 @@ - + @@ -67,11 +67,11 @@ - + diff --git a/gulpfile.js b/gulpfile.js index 22740ed0..24ff11d7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -16,7 +16,10 @@ var fs = require("fs"), prefix = require("gulp-autoprefixer"), svgstore = require("gulp-svgstore"), svgmin = require("gulp-svgmin"), - hogan = require("gulp-hogan-compile"); + hogan = require("gulp-hogan-compile"), + rename = require("gulp-rename"), + s3 = require("gulp-s3"), + gzip = require("gulp-gzip"); var root = __dirname, paths = { @@ -29,11 +32,7 @@ var root = __dirname, sprite: path.join(root, "src/sprite/*.svg") }, // Output paths - output: { - js: path.join(root, "dist/js/"), - css: path.join(root, "dist/css/"), - sprite: path.join(root, "dist/") - } + output: path.join(root, "dist/") }, docs: { // Source paths @@ -43,10 +42,7 @@ var root = __dirname, templates: path.join(root, "docs/src/templates/*.html") }, // Output paths - output: { - js: path.join(root, "docs/dist/js/"), - css: path.join(root, "docs/dist/css/") - } + output: path.join(root, "docs/dist/") } }, @@ -58,7 +54,8 @@ tasks = { }, // Fetch bundles from JSON -bundles = loadJSON(path.join(root, "bundles.json")); +bundles = loadJSON(path.join(root, "bundles.json")), +package = loadJSON(path.join(root, "package.json")); // Load json function loadJSON(path) { @@ -66,7 +63,7 @@ function loadJSON(path) { } var build = { - js: function (files, bundle, output) { + js: function (files, bundle) { for (var key in files) { (function(key) { var name = "js-" + key; @@ -77,12 +74,12 @@ var build = { .src(bundles[bundle].js[key]) .pipe(concat(key)) .pipe(uglify()) - .pipe(gulp.dest(output)); + .pipe(gulp.dest(paths[bundle].output)); }); })(key); } }, - less: function(files, bundle, output) { + less: function(files, bundle) { for (var key in files) { (function (key) { var name = "less-" + key; @@ -96,12 +93,12 @@ var build = { .pipe(concat(key)) .pipe(prefix(["last 2 versions"], { cascade: true })) .pipe(minify()) - .pipe(gulp.dest(output)); + .pipe(gulp.dest(paths[bundle].output)); }); })(key); } }, - sass: function(files, bundle, output) { + sass: function(files, bundle) { for (var key in files) { (function (key) { var name = "sass-" + key; @@ -115,51 +112,51 @@ var build = { .pipe(concat(key)) .pipe(prefix(["last 2 versions"], { cascade: true })) .pipe(minify()) - .pipe(gulp.dest(output)); + .pipe(gulp.dest(paths[bundle].output)); }); })(key); } }, - sprite: function(source, output) { + sprite: function() { // Process Icons gulp.task("sprite", function () { return gulp - .src(source) + .src(paths.plyr.src.sprite) .pipe(svgmin({ plugins: [{ removeDesc: true }] })) .pipe(svgstore()) - .pipe(gulp.dest(output)); + .pipe(gulp.dest(paths.plyr.output)); }); }, - templates: function(source, output) { + templates: function() { // Build templates gulp.task("templates", function () { return gulp - .src(source) + .src(paths.docs.src.templates) .pipe(hogan("templates.js", { wrapper: false, templateName: function (file) { return path.basename(file.relative.replace(/\\/g, "-"), path.extname(file.relative)); } })) - .pipe(gulp.dest(output)); + .pipe(gulp.dest(paths.docs.output)); }); } }; // Plyr core files -build.js(bundles.plyr.js, "plyr", paths.plyr.output.js); -build.less(bundles.plyr.less, "plyr", paths.plyr.output.css); -build.sass(bundles.plyr.sass, "plyr", paths.plyr.output.css); -build.sprite(paths.plyr.src.sprite, paths.plyr.output.sprite); +build.js(bundles.plyr.js, "plyr"); +build.less(bundles.plyr.less, "plyr"); +build.sass(bundles.plyr.sass, "plyr"); +build.sprite(); // Docs files -build.templates(paths.docs.src.templates, paths.docs.output.js); -build.less(bundles.docs.less, "docs", paths.docs.output.css); -build.js(bundles.docs.js, "docs", paths.docs.output.js); +build.templates(); +build.less(bundles.docs.less, "docs"); +build.js(bundles.docs.js, "docs"); // Default gulp task gulp.task("default", function(){ @@ -187,4 +184,35 @@ gulp.task("watch", function () { gulp.watch(paths.docs.src.js, tasks.js); gulp.watch(paths.docs.src.less, tasks.less); gulp.watch(paths.docs.src.templates, "js"); +}); + +// Publish the docs site +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("Publishing " + version); + + return gulp.src("dist/**") + .pipe(rename(function (path) { + path.dirname = path.dirname.replace(".", version); + })) + .pipe(gzip()) + .pipe(s3(aws, options)); + } + catch (e) {} +}); + +gulp.task("publish", function () { + }); \ No newline at end of file diff --git a/package.json b/package.json index b60b2a6a..b434446e 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,12 @@ "gulp": "~3.8.6", "gulp-autoprefixer": "^0.0.8", "gulp-concat": "~2.3.3", + "gulp-gzip": "^1.0.0", "gulp-hogan-compile": "^0.4.1", "gulp-less": "~1.3.1", "gulp-minify-css": "~0.3.6", + "gulp-rename": "^1.2.0", + "gulp-s3": "^0.3.0", "gulp-sass": "^1.3.3", "gulp-svgmin": "^1.0.0", "gulp-svgstore": "^5.0.0", diff --git a/readme.md b/readme.md index a043445d..58e279e2 100644 --- a/readme.md +++ b/readme.md @@ -30,7 +30,7 @@ If you have any cool ideas or features, please let me know by [creating an issue ## Implementation -Check `docs/index.html` and `docs/dist/js/docs.js` for an example setup. +Check `docs/index.html` and `docs/dist/docs.js` for an example setup. ### Bower If bower is your thang, you can grab Plyr using: @@ -43,7 +43,7 @@ More info on setting up dependencies can be found in the [Bower Docs](http://bow 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. ```html - + ``` ### SVG @@ -62,7 +62,7 @@ The SVG sprite for the controls icons is loaded in by AJAX to help with performa c.innerHTML=a.responseText; b.insertBefore(c,b.childNodes[0]) } -})(document,"dist/svg/sprite.svg"); +})(document,"dist/sprite.svg"); ``` More info on SVG sprites here: @@ -116,7 +116,7 @@ More info on CORS here: Much of the behaviour of the player is configurable when initialising the library. Below is an example of a default instance. ```html - +