aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.js
diff options
context:
space:
mode:
authorSam Potts <me@sampotts.me>2015-08-27 07:36:17 +1000
committerSam Potts <me@sampotts.me>2015-08-27 07:36:17 +1000
commit95e39e7bd724a27d07086f10c5333ed51073121d (patch)
treeb2a8f1d7512a484548a520bf2898a7a772ab77ec /gulpfile.js
parent0785ca602400d92d6fe596cc7202d57d3b04d220 (diff)
parent6543fc1e5bb8445f816b8206f6b36521dead6364 (diff)
downloadplyr-95e39e7bd724a27d07086f10c5333ed51073121d.tar.lz
plyr-95e39e7bd724a27d07086f10c5333ed51073121d.tar.xz
plyr-95e39e7bd724a27d07086f10c5333ed51073121d.zip
Merge branch 'master' into develop
# Conflicts: # dist/plyr.css # dist/plyr.js # docs/dist/docs.css # docs/src/less/components/examples.less # src/js/plyr.js
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js27
1 files changed, 18 insertions, 9 deletions
diff --git a/gulpfile.js b/gulpfile.js
index 6c84bf69..5b354740 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -66,7 +66,12 @@ package = loadJSON(path.join(root, "package.json"));
// Load json
function loadJSON(path) {
- return JSON.parse(fs.readFileSync(path));
+ try {
+ return JSON.parse(fs.readFileSync(path));
+ }
+ catch(err) {
+ return {};
+ }
}
var build = {
@@ -165,11 +170,6 @@ build.templates();
build.less(bundles.docs.less, "docs");
build.js(bundles.docs.js, "docs");
-// Default gulp task
-gulp.task("default", function(){
- run("templates", tasks.js, tasks.less, "sprite");
-});
-
// Build all JS (inc. templates)
gulp.task("js", function(){
run("templates", tasks.js);
@@ -193,6 +193,11 @@ gulp.task("watch", function () {
gulp.watch(paths.docs.src.templates, ["js"]);
});
+// Default gulp task
+gulp.task("default", function(){
+ run("templates", tasks.js, tasks.less, "sprite", "watch");
+});
+
// Publish a version to CDN and docs
// --------------------------------------------
@@ -203,7 +208,7 @@ maxAge = 31536000, // seconds 1 year
options = {
cdn: {
headers: {
- "Cache-Control": "max-age=" + maxAge + ", no-transform, public",
+ "Cache-Control": "max-age=" + maxAge,
"Vary": "Accept-Encoding"
},
gzippedOnly: true
@@ -215,8 +220,12 @@ options = {
},
gzippedOnly: true
}
-},
-cdnpath = new RegExp(aws.cdn.bucket + "\/(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)","gi");
+};
+
+// If aws is setup
+if("cdn" in aws) {
+ var cdnpath = new RegExp(aws.cdn.bucket + "\/(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)","gi");
+}
// Publish version to CDN bucket
gulp.task("cdn", function () {