diff --git a/build.sh b/build.sh index 956cabdda..1ef8a7209 100755 --- a/build.sh +++ b/build.sh @@ -39,9 +39,6 @@ CleanFolder() find $path -name "FluentValidation.resources.dll" -exec rm "{}" \; find $path -name "App.config" -exec rm "{}" \; - echo "Removing .less files" - find $path -name "*.less" -exec rm "{}" \; - echo "Removing vshost files" find $path -name "*.vshost.exe" -exec rm "{}" \; diff --git a/frontend/gulp/gulpFile.js b/frontend/gulp/gulpFile.js index 821935a31..744dd8d7e 100644 --- a/frontend/gulp/gulpFile.js +++ b/frontend/gulp/gulpFile.js @@ -1,9 +1,7 @@ require('./build.js'); require('./clean.js'); require('./copy.js'); -require('./handlebars.js'); require('./imageMin.js'); -require('./less.js'); require('./start.js'); require('./stripBom.js'); require('./watch.js'); diff --git a/frontend/gulp/handlebars.js b/frontend/gulp/handlebars.js deleted file mode 100644 index 679a0b7f6..000000000 --- a/frontend/gulp/handlebars.js +++ /dev/null @@ -1,70 +0,0 @@ -var gulp = require('gulp'); -var handlebars = require('gulp-handlebars'); -var declare = require('gulp-declare'); -var concat = require('gulp-concat'); -var wrap = require('gulp-wrap'); -var livereload = require('gulp-livereload'); -var path = require('path'); -var streamqueue = require('streamqueue'); -var stripbom = require('gulp-stripbom'); -var compliler = require('handlebars'); - -var errorHandler = require('./helpers/errorHandler'); -var paths = require('./helpers/paths.js'); - -console.log('Handlebars (gulp) Version: ', compliler.VERSION); -console.log('Handlebars (gulp) Compiler: ', compliler.COMPILER_REVISION); - -gulp.task('handlebars', () => { - var coreStream = gulp.src([ - paths.src.templates, - '!*/**/*Partial.*' - ]) - .pipe(stripbom({ - showLog: false - })) - .pipe(handlebars({ - handlebars: compliler - })) - .on('error', errorHandler) - .pipe(declare({ - namespace: 'T', - noRedeclare: true, - processName: (filePath) => { - filePath = path.relative(paths.src.root, filePath); - - return filePath.replace(/\\/g, '/') - .toLocaleLowerCase() - .replace('template', '') - .replace('.js', ''); - } - })); - - var partialStream = gulp.src([paths.src.partials]) - .pipe(stripbom({ - showLog: false - })) - .pipe(handlebars({ - handlebars: compliler - })) - .on('error', errorHandler) - .pipe(wrap('Handlebars.template(<%= contents %>)')) - .pipe(wrap('Handlebars.registerPartial(<%= processPartialName(file.relative) %>, <%= contents %>)', {}, { - imports: { - processPartialName: function(fileName) { - return JSON.stringify( - path.basename(fileName, '.js') - ); - } - } - })); - - return streamqueue({ - objectMode: true - }, - partialStream, - coreStream - ).pipe(concat('templates.js')) - .pipe(gulp.dest(paths.dest.root)) - .pipe(livereload()); -}); diff --git a/frontend/gulp/helpers/paths.js b/frontend/gulp/helpers/paths.js index 88498d6f7..b96b5aaeb 100644 --- a/frontend/gulp/helpers/paths.js +++ b/frontend/gulp/helpers/paths.js @@ -3,11 +3,8 @@ const root = './frontend/src/'; const paths = { src: { root, - templates: root + '**/*.hbs', html: root + '*.html', - partials: root + '**/*Partial.hbs', scripts: root + '**/*.js', - less: [root + '**/*.less'], content: root + 'Content/', fonts: root + 'Content/Fonts/', images: root + 'Content/Images/', @@ -16,10 +13,10 @@ const paths = { } }, dest: { - root: './_output/UI.Phantom/', - content: './_output/UI.Phantom/Content/', - fonts: './_output/UI.Phantom/Content/Fonts/', - images: './_output/UI.Phantom/Content/Images/' + root: './_output/UI/', + content: './_output/UI/Content/', + fonts: './_output/UI/Content/Fonts/', + images: './_output/UI/Content/Images/' } }; diff --git a/frontend/gulp/helpers/phantom.js b/frontend/gulp/helpers/phantom.js deleted file mode 100644 index 1d696853a..000000000 --- a/frontend/gulp/helpers/phantom.js +++ /dev/null @@ -1,10 +0,0 @@ -var phantom = false; -process.argv.forEach((val) => { - if (val === '--phantom') { - phantom = true; - } -}); - -console.log('Phantom:', phantom); - -module.exports = phantom; diff --git a/frontend/gulp/less.js b/frontend/gulp/less.js deleted file mode 100644 index 797cb80cf..000000000 --- a/frontend/gulp/less.js +++ /dev/null @@ -1,46 +0,0 @@ -const gulp = require('gulp'); - -const less = require('gulp-less'); -const postcss = require('gulp-postcss'); -const sourcemaps = require('gulp-sourcemaps'); -const autoprefixer = require('autoprefixer'); -const livereload = require('gulp-livereload'); -const path = require('path'); - -const print = require('gulp-print'); -const paths = require('./helpers/paths'); -const errorHandler = require('./helpers/errorHandler'); - -gulp.task('less', () => { - const src = [ - path.join(paths.src.content, 'Bootstrap', 'bootstrap.less'), - path.join(paths.src.content, 'Vendor', 'vendor.less'), - path.join(paths.src.content, 'sonarr.less') - ]; - - return gulp.src(src) - .pipe(print()) - .pipe(sourcemaps.init()) - .pipe(less({ - paths: [paths.src.root], - dumpLineNumbers: 'false', - compress: true, - yuicompress: true, - ieCompat: true, - strictImports: true - })) - .on('error', errorHandler) - .pipe(postcss([autoprefixer({ - browsers: ['last 2 versions'] - })])) - .on('error', errorHandler) - - // not providing a path will cause the source map - // to be embeded. which makes livereload much happier - // since it doesn't reload the whole page to load the map. - // this should be switched to sourcemaps.write('./') for production builds - .pipe(sourcemaps.write()) - .pipe(gulp.dest(paths.dest.content)) - .on('error', errorHandler) - .pipe(livereload()); -}); diff --git a/frontend/gulp/stripBom.js b/frontend/gulp/stripBom.js index 86a20bbe9..080b86dfe 100644 --- a/frontend/gulp/stripBom.js +++ b/frontend/gulp/stripBom.js @@ -6,14 +6,6 @@ function stripBom(dest) { gulp.src([paths.src.scripts, paths.src.exclude.libs]) .pipe(stripbom({ showLog: false })) .pipe(gulp.dest(dest)); - - gulp.src(paths.src.less) - .pipe(stripbom({ showLog: false })) - .pipe(gulp.dest(dest)); - - gulp.src(paths.src.templates) - .pipe(stripbom({ showLog: false })) - .pipe(gulp.dest(dest)); } gulp.task('stripBom', () => { diff --git a/frontend/src/Activity/History/Details/HistoryDetailsAge.js b/frontend/src/Activity/History/Details/HistoryDetailsAge.js deleted file mode 100644 index c702014ce..000000000 --- a/frontend/src/Activity/History/Details/HistoryDetailsAge.js +++ /dev/null @@ -1,21 +0,0 @@ -var Handlebars = require('handlebars'); -var FormatHelpers = require('Shared/FormatHelpers'); - -Handlebars.registerHelper('historyAge', function() { - var age = this.age; - var unit = FormatHelpers.plural(Math.round(age), 'day'); - var ageHours = parseFloat(this.ageHours); - var ageMinutes = this.ageMinutes ? parseFloat(this.ageMinutes) : null; - - if (age < 2) { - age = ageHours.toFixed(1); - unit = FormatHelpers.plural(Math.round(ageHours), 'hour'); - } - - if (age < 2 && ageMinutes) { - age = parseFloat(ageMinutes).toFixed(1); - unit = FormatHelpers.plural(Math.round(ageMinutes), 'minute'); - } - - return new Handlebars.SafeString(`