From bde9894dbcfa2d0de9a4ec7cbfd673d7a4666f12 Mon Sep 17 00:00:00 2001 From: AJ Ortega Date: Fri, 10 Apr 2015 20:07:49 -0700 Subject: [PATCH] Build polymer --- .gitignore | 2 + build.bat | 2 - dist/polymer-micro.html | 487 +++++++ dist/polymer-mini.html | 949 ++++++++++++ dist/polymer.html | 3051 +++++++++++++++++++++++++++++++++++++++ gulpfile.js | 43 + package.json | 31 + 7 files changed, 4563 insertions(+), 2 deletions(-) create mode 100644 .gitignore delete mode 100644 build.bat create mode 100644 dist/polymer-micro.html create mode 100644 dist/polymer-mini.html create mode 100644 dist/polymer.html create mode 100644 gulpfile.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..7bf6eb18f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bower_components +node_modules diff --git a/build.bat b/build.bat deleted file mode 100644 index 12479f7da9..0000000000 --- a/build.bat +++ /dev/null @@ -1,2 +0,0 @@ -START /B vulcanize polymer-simplex.html --inline --strip -output dist/polymer-simplex.html -START /B vulcanize polymer.html --inline --strip -output dist/polymer.html diff --git a/dist/polymer-micro.html b/dist/polymer-micro.html new file mode 100644 index 0000000000..9a43e5a49f --- /dev/null +++ b/dist/polymer-micro.html @@ -0,0 +1,487 @@ + + + \ No newline at end of file diff --git a/dist/polymer-mini.html b/dist/polymer-mini.html new file mode 100644 index 0000000000..cd670fabd6 --- /dev/null +++ b/dist/polymer-mini.html @@ -0,0 +1,949 @@ + + + + \ No newline at end of file diff --git a/dist/polymer.html b/dist/polymer.html new file mode 100644 index 0000000000..078429c457 --- /dev/null +++ b/dist/polymer.html @@ -0,0 +1,3051 @@ + + + + \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000000..3e4d828893 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,43 @@ +var gulp = require('gulp'); +var replace = require('gulp-replace'); +var shell = require('gulp-shell'); + +var polyclean = require('polyclean'); + +function vulcanize(filename, dstdir, excludes) { + var cmd = 'node_modules/vulcanize/bin/vulcanize'; + if (excludes && excludes.length > 0) { + excludes.forEach(function(exclude) { + cmd = cmd + ' --exclude ' + exclude; + }); + cmd = cmd + ' --implicit-strip'; + } + cmd = cmd + ' ' + filename + ' > ' + dstdir + '/' + filename; + return cmd +} + +var micro = "polymer-micro.html"; +var mini = "polymer-mini.html"; +var max = "polymer.html"; + +gulp.task('micro', shell.task(vulcanize(micro, 'dist'))); +gulp.task('mini', shell.task(vulcanize(mini, 'dist', [micro]))); +gulp.task('max', shell.task(vulcanize(max, 'dist', [mini, micro]))); + +gulp.task('strip', ['micro', 'mini', 'max'], function() { + return gulp.src('dist/*.html') + .pipe(polyclean.cleanJsComments()) + // Get rid of erroneous html comments + .pipe(replace(//g, '')) + // Reduce script tags + .pipe(replace(/<\/script>\s*