diff --git a/README.md b/README.md index 15e6c86e..fb990ebc 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The Blogophon _generator_ works on every platform with [NodeJs](https://nodejs.o Installation ------------ -1. Make sure you have [Node.js](https://nodejs.org/) installed by calling `node -v`. +1. Make sure you have [Node.js](https://nodejs.org/) with at least version 4 installed by calling `node -v`. 1. Make sure you have [ImageMagick](http://www.imagemagick.org/) installed by calling `magick -help`. ImageMagick is needed for scaling images. 1. Run `npm install -g blogophon` to install the Blogophon. 1. Change to a folder you want to initialize a Blogophon blog project in. diff --git a/generate.js b/generate.js index 100b16c2..fdd4a241 100755 --- a/generate.js +++ b/generate.js @@ -1,12 +1,12 @@ #!/usr/bin/env node 'use strict'; -var application = require('./src/helpers/application')(); +const application = require('./src/helpers/application')(); application.changeDirectory(); -var Generator = require('./src/generator'); -var args = require('./src/helpers/arguments')(); -var config = require('./src/config'); +const Generator = require('./src/generator'); +const args = require('./src/helpers/arguments')(); +const config = require('./src/config'); if (args.help) { console.log('Usage: node generate.js [OPTIONS]'); @@ -24,20 +24,20 @@ if (args.help) { console.log('---- ' + new Date() + ' -----'); } -var generator = Generator(config); +const generator = Generator(config); generator .getArticles() - .then(function() { + .then(() => { return generator.buildAll(args.force || args.f, args.noimages || args.I); }) - .then(function() { + .then(() => { if(args.deploy || args.d || args.publish) { generator.deploy(); } else { console.log('Done'); } }) - .catch(function(err) { + .catch((err) => { console.error(err); process.exit(1); }) ; diff --git a/gulpfile.js b/gulpfile.js index 69a3ee82..f811ed08 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,25 +1,25 @@ 'use strict'; // Include gulp -var gulp = require('gulp'); -var pkg = require('./package.json'); -var beep = require('beepbeep'); -var onError = function() { +let gulp = require('gulp'); +let pkg = require('./package.json'); +let beep = require('beepbeep'); +let onError = function() { beep(); return true; }; // Include Our Plugins -var eslint = require('gulp-eslint'); -var nodeunit = require('gulp-nodeunit'); -var gls = require('gulp-live-server'); -var plumber = require('gulp-plumber'); -var sass = require('gulp-sass'); -var rename = require("gulp-rename"); -var uglify = require('gulp-uglify'); -var postcss = require('gulp-postcss'); -var replace = require('gulp-replace'); -var autoprefixer = require('autoprefixer'); +let eslint = require('gulp-eslint'); +let nodeunit = require('gulp-nodeunit'); +let gls = require('gulp-live-server'); +let plumber = require('gulp-plumber'); +let sass = require('gulp-sass'); +let rename = require("gulp-rename"); +let uglify = require('gulp-uglify'); +let postcss = require('gulp-postcss'); +let replace = require('gulp-replace'); +let autoprefixer = require('autoprefixer'); // Lint Task gulp.task('eslint', function() { @@ -102,7 +102,7 @@ gulp.task('build-css', function() { }); gulp.task('serve', function() { - var server = gls.static(pkg.directories.htdocs); + let server = gls.static(pkg.directories.htdocs); server.start(); gulp.watch(pkg.directories.htdocs + '/**/*', function(file) { /* eslint-disable */ diff --git a/index.js b/index.js index 78e707ae..45e088bb 100755 --- a/index.js +++ b/index.js @@ -1,11 +1,11 @@ #!/usr/bin/env node 'use strict'; -var application = require('./src/helpers/application')(); +const application = require('./src/helpers/application')(); application.changeDirectory(); -var blogophonConsole = require('./src/blogophon-console'); -var args = require('./src/helpers/arguments')(); +const blogophonConsole = require('./src/blogophon-console'); +const args = require('./src/helpers/arguments')(); if (args.help) { console.log('Usage: node index.js [OPTIONS]'); diff --git a/package.json b/package.json index 46799456..2debb19f 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,9 @@ "env": { "node": true }, + "parserOptions": { + "ecmaVersion": 6 + }, "globals": {}, "rules": { "brace-style": 2, @@ -133,11 +136,14 @@ "no-multi-str": 2, "valid-jsdoc": [ 1 - ] + ], + "no-var": 2 }, "extends": [ "eslint:recommended" ] }, - "engine": "node >= 0.12.0" + "engine": { + "node": ">=4" + } } diff --git a/src/blogophon-console.js b/src/blogophon-console.js index 13e35a39..474fe00f 100644 --- a/src/blogophon-console.js +++ b/src/blogophon-console.js @@ -1,26 +1,26 @@ 'use strict'; -var inquirer = require('inquirer'); -var fs = require('fs-extra-promise'); -var path = require('path'); -var shell = require('shelljs'); -var config = require('./config'); -var Mustache = require('./helpers/blogophon-mustache'); -var setup = require('./setup')(); -var Generator = require('./generator'); -var blogophonDate = require('./models/blogophon-date'); -var blogophonEditor = require('./editor')(config); +const inquirer = require('inquirer'); +const fs = require('fs-extra-promise'); +const path = require('path'); +const shell = require('shelljs'); +const config = require('./config'); +const Mustache = require('./helpers/blogophon-mustache'); +const setup = require('./setup')(); +const Generator = require('./generator'); +const blogophonDate = require('./models/blogophon-date'); +const blogophonEditor = require('./editor')(config); /** * Represents the Inquirer dialog with which to edit articles. * @constructor * @return {Object} [description] */ -var BlogophonConsole = function() { - var external = {}; - var internal = {}; - var files = []; - var choicesStr = [ +const BlogophonConsole = function() { + const external = {}; + const internal = {}; + let files = []; + const choicesStr = [ 'Create new article', 'Edit existing article', 'Rename article', @@ -42,7 +42,7 @@ var BlogophonConsole = function() { * @return {Array} [description] */ internal.makeChoices = function() { - var choices = []; + let choices = []; if (!config.notInitialized) { files = blogophonEditor.makeFiles(new inquirer.Separator()); choices.push(choicesStr[0]); @@ -66,7 +66,7 @@ var BlogophonConsole = function() { } else { console.log(markdownFilename + ' created'); if (templateData.edit) { - var cmd = config.isWin + let cmd = config.isWin ? 'START ' + markdownFilename : 'open ' + markdownFilename + ' || vi '+ markdownFilename ; @@ -85,10 +85,10 @@ var BlogophonConsole = function() { * @return {[type]} [description] */ external.setupDialog = function() { - var themesAvailable= fs.readdirSync(config.directories.theme).filter(function(file) { + let themesAvailable= fs.readdirSync(config.directories.theme).filter(function(file) { return fs.statSync(path.join(config.directories.theme, file)).isDirectory(); }); - var questions = [ + let questions = [ { type: 'input', name: 'name', @@ -256,7 +256,7 @@ var BlogophonConsole = function() { * @return {[type]} [description] */ external.createArticleDialog = function() { - var defaults = { + let defaults = { classes: 'Normal article', link: '', location: '', @@ -300,7 +300,7 @@ var BlogophonConsole = function() { } }; - var questions = [ + let questions = [ { type: 'list', name: 'classes', @@ -318,7 +318,7 @@ var BlogophonConsole = function() { if (v.trim().length <= 2) { return 'This title is way too short.'; } - var filename = blogophonEditor.filenameFromTitle(v); + let filename = blogophonEditor.filenameFromTitle(v); if (fs.existsSync(filename)) { return ("File " + filename + ' already exists'); } @@ -440,9 +440,9 @@ var BlogophonConsole = function() { function(answers) { answers.title = answers.title || Math.round(new Date().getTime() / 1000); answers.date = answers.date || defaults.date; - var markdownFilename = blogophonEditor.filenameFromTitle(blogophonEditor.titleForFilename(answers.title, config, answers.date)) + '.md'; - var filename = blogophonEditor.dirnameFromFilename(markdownFilename); // TODO: There is a class for that - var templateData = answers; + let markdownFilename = blogophonEditor.filenameFromTitle(blogophonEditor.titleForFilename(answers.title, config, answers.date)) + '.md'; + let filename = blogophonEditor.dirnameFromFilename(markdownFilename); // TODO: There is a class for that + let templateData = answers; templateData.isMicropost = (answers.classes === 'Micro post'); templateData.lead = templateData.lead || defaults.lead(answers); templateData.mainText = templateData.mainText || defaults.mainText(answers); @@ -473,7 +473,7 @@ var BlogophonConsole = function() { * @return {void} [description] */ external.editArticleDialog = function() { - var questions = [ + let questions = [ { type: 'list', name: 'file', @@ -483,8 +483,8 @@ var BlogophonConsole = function() { ]; inquirer.prompt(questions).then( function(answers) { - var markdownFilename = path.join(config.directories.data, answers.file); - var cmd = config.isWin ? 'START ' + markdownFilename : 'open ' + markdownFilename + ' || vi '+ markdownFilename; + let markdownFilename = path.join(config.directories.data, answers.file); + let cmd = config.isWin ? 'START ' + markdownFilename : 'open ' + markdownFilename + ' || vi '+ markdownFilename; console.log('$ ' + cmd); shell.exec(cmd); external.init(); @@ -500,7 +500,7 @@ var BlogophonConsole = function() { * @return {void} [description] */ external.renameArticleDialog = function() { - var questions = [ + let questions = [ { type: 'list', name: 'file', @@ -521,8 +521,8 @@ var BlogophonConsole = function() { inquirer.prompt(questions).then( function(answers) { if (answers.fileNew) { - var processed = 0, maxProcessed = 2; - var checkProcessed = function(err) { + let processed = 0, maxProcessed = 2; + let checkProcessed = function(err) { if (err) { console.error(err); } @@ -565,7 +565,7 @@ var BlogophonConsole = function() { * @return {void} [description] */ external.deleteArticleDialog = function() { - var questions = [ + let questions = [ { type: 'list', name: 'file', @@ -581,8 +581,8 @@ var BlogophonConsole = function() { inquirer.prompt(questions).then( function(answers) { if (answers.sure) { - var processed = 0, maxProcessed = 3; - var checkProcessed = function(err) { + let processed = 0, maxProcessed = 3; + let checkProcessed = function(err) { if (err) { console.error(err); } @@ -610,7 +610,7 @@ var BlogophonConsole = function() { * @return {void} [description] */ external.generateDialog = function() { - var questions = [ + let questions = [ { type: 'confirm', name: 'noforce', @@ -626,8 +626,8 @@ var BlogophonConsole = function() { } } ]; - var generator = Generator(config); - var answers; + let generator = Generator(config); + let answers; inquirer .prompt(questions) .then(function(inquirerAnswers) { @@ -659,7 +659,7 @@ var BlogophonConsole = function() { fs.ensureDirSync(config.directories.htdocs); external.setupDialog(); } else { - var questions = [ + let questions = [ { type: 'list', name: 'action', diff --git a/src/blogophon-index.js b/src/blogophon-index.js index 9bfb00da..a466a11d 100644 --- a/src/blogophon-index.js +++ b/src/blogophon-index.js @@ -5,9 +5,9 @@ * @constructor * @return {blogophonIndex} [description] */ -var blogophonIndex = function() { - var external = {}; - var internal = {}; +const blogophonIndex = function() { + const external = {}; + const internal = {}; external.index = []; internal.isSorted = true; @@ -71,8 +71,8 @@ var blogophonIndex = function() { if (!internal.isSorted) { external.sortblogophonIndex(); } - var now = Math.round(new Date().getTime() / 1000); - var count = 0, i; + let now = Math.round(new Date().getTime() / 1000); + let count = 0, i; for(i = 0; i < external.index.length; i++) { if (external.index[i].meta.Created.timestamp > now) { count++; @@ -91,10 +91,10 @@ var blogophonIndex = function() { * @return {[type]} [description] */ external.removeDrafts = function() { - var newIndex = external.index.filter(function(value) { + let newIndex = external.index.filter(function(value) { return !value.meta.Draft; }); - var count = external.index.length - newIndex.length; + let count = external.index.length - newIndex.length; external.index = newIndex; return count; }; @@ -107,7 +107,7 @@ var blogophonIndex = function() { if (!internal.isSorted) { external.sortblogophonIndex(); } - var i; + let i; for(i = 0; i < external.index.length; i++) { if (i > 0 && external.index[i-1]) { external.index[i].prev = external.index[i-1].meta; @@ -139,7 +139,7 @@ var blogophonIndex = function() { if (!internal.isSorted) { external.sortblogophonIndex(); } - var tags = {}; + let tags = {}; external.index.forEach(function(post){ if (post.meta.Tags) { post.meta.Tags.forEach(function(tag){ @@ -162,7 +162,7 @@ var blogophonIndex = function() { if (!internal.isSorted) { external.sortblogophonIndex(); } - var authors = {}; + let authors = {}; external.index.forEach(function(post){ if (post.meta.AuthorName) { if (!authors[post.meta.AuthorName]) { @@ -204,7 +204,7 @@ var blogophonIndex = function() { if (!itemsPerPage) { itemsPerPage = 10; } - var pages = [], page = 0, newblogophonIndex = external.index, currentSlice = []; + let pages = [], page = 0, newblogophonIndex = external.index, currentSlice = []; if (reverse) { newblogophonIndex = newblogophonIndex.reverse(); } diff --git a/src/config.js b/src/config.js index 326e8659..839c43a6 100644 --- a/src/config.js +++ b/src/config.js @@ -1,13 +1,13 @@ 'use strict'; -var fs = require('fs'); -var path = require('path'); +const fs = require('fs'); +const path = require('path'); /** * Returns an object with all configuration settings found in `package.json` and `config.json`. */ -var pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')); -var config = {}; +const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')); +let config = {}; try { config = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'user', 'config.json'), 'utf8')); } catch (e) { diff --git a/src/editor.js b/src/editor.js index dd8ff155..75bf3f1f 100644 --- a/src/editor.js +++ b/src/editor.js @@ -1,16 +1,16 @@ 'use strict'; -var glob = require('glob'); -var fs = require('fs-extra-promise'); -var path = require('path'); -var shell = require('shelljs'); -var https = require('https'); -var blogophonDate = require('./models/blogophon-date'); -var SuperString = require('./helpers/super-string'); -var Mustache = require('./helpers/blogophon-mustache'); +const glob = require('glob'); +const fs = require('fs-extra-promise'); +const path = require('path'); +const shell = require('shelljs'); +const https = require('https'); +const blogophonDate = require('./models/blogophon-date'); +const SuperString = require('./helpers/super-string'); +const Mustache = require('./helpers/blogophon-mustache'); -var editor = function(config) { - var external = {}; +const editor = function(config) { + const external = {}; /** * Get listing of all Markdown files which may be edited @@ -18,11 +18,11 @@ var editor = function(config) { * @return {Array} [description] */ external.makeFiles = function(separator) { - var files = []; + let files = []; if (!config.notInitialized) { files = glob.sync(config.directories.data + "/**/*.{md,md~}").map(function(v) { - var filename = v.replace(/^.+\/(.+?)$/, '$1'); - var fileStat = fs.lstatSync(v); + let filename = v.replace(/^.+\/(.+?)$/, '$1'); + let fileStat = fs.lstatSync(v); return { name: fileStat.mtime.toLocaleString(config.locale.language || 'en') + "\t" + filename + "\t" +Math.ceil(fileStat.size/1000)+' kB', @@ -101,12 +101,12 @@ var editor = function(config) { host: 'nominatim.openstreetmap.org', path: '/search?q='+encodeURIComponent(address)+'&format=json&accept-language='+encodeURIComponent(language || 'en') }, function(response) { - var body = ''; + let body = ''; response.on('data', function(d) { body += d; }); response.on('end', function() { - var parsed = JSON.parse(body); + let parsed = JSON.parse(body); callback(null, { latitude: parsed[0] ? parsed[0].lat : null, longitude: parsed[0] ? parsed[0].lon : null diff --git a/src/generator.js b/src/generator.js index f9ec41da..b5897965 100644 --- a/src/generator.js +++ b/src/generator.js @@ -1,36 +1,36 @@ 'use strict'; -var glob = require("glob"); -var Promise = require('promise/lib/es6-extensions'); -var fs = require('fs-extra-promise'); -var path = require('path'); -var SuperString = require('./helpers/super-string'); -var blogophonDate = require('./models/blogophon-date'); -var Mustache = require('./helpers/blogophon-mustache'); -var PostReader = require('./post-reader'); -var jsonRss = require('./models/json-rss'); -var geoJson = require('./models/geo-json'); -var translations = require('./helpers/translations'); -var indexUrl = require('./helpers/index-url'); -var blogophonIndex = require('./blogophon-index'); -var hashes = require('./models/hashes'); -var appleNewsFormat = require('./models/apple-news-format'); -var imageStyles = require('./helpers/image-styles'); -var ampify = require('./helpers/ampify')(); -var slacked = require('./models/slacked'); -var jsonFeed = require('./models/json-feed'); +const glob = require("glob"); +const Promise = require('promise/lib/es6-extensions'); +const fs = require('fs-extra-promise'); +const path = require('path'); +const SuperString = require('./helpers/super-string'); +const blogophonDate = require('./models/blogophon-date'); +const Mustache = require('./helpers/blogophon-mustache'); +const PostReader = require('./post-reader'); +const jsonRss = require('./models/json-rss'); +const geoJson = require('./models/geo-json'); +const translations = require('./helpers/translations'); +const indexUrl = require('./helpers/index-url'); +const blogophonIndex = require('./blogophon-index'); +const hashes = require('./models/hashes'); +const appleNewsFormat = require('./models/apple-news-format'); +const imageStyles = require('./helpers/image-styles'); +const ampify = require('./helpers/ampify')(); +const slacked = require('./models/slacked'); +const jsonFeed = require('./models/json-feed'); /** * Generator used for creating the blog. * @constructor * @param {Object} config [description] */ -var Generator = function(config) { +const Generator = function(config) { if (!config) { throw new Error('config is empty'); } - var external = {}; - var internal = {}; + const external = {}; + const internal = {}; Mustache.getTemplates(); Mustache.getThemeTemplates(path.join(config.directories.currentTheme, 'templates')); @@ -57,7 +57,7 @@ var Generator = function(config) { reject(err); } // Making promises - var promises = files.map(function(i) { + let promises = files.map(function(i) { return PostReader(i, config); }); // Checking promises @@ -84,9 +84,9 @@ var Generator = function(config) { * @return {Promise} with first parameter of `resolve` being the list of files generated. */ external.buildAllArticles = function(force, noimages) { - var allPosts = internal.currentIndex.getPosts(); - var skipped = 0; - var generatedArticles = []; + let allPosts = internal.currentIndex.getPosts(); + let skipped = 0; + let generatedArticles = []; if (force && !noimages) { fs.removeSync(path.join(config.directories.htdocs, config.htdocs.posts, '*')); @@ -95,7 +95,7 @@ var Generator = function(config) { return new Promise( function(resolve, reject) { // Making promises - var promises = allPosts.map(function(post) { + let promises = allPosts.map(function(post) { if (!force && internal.hashes.matchesHash(post.meta.Url, post.hash)) { skipped++; } else { @@ -130,7 +130,7 @@ var Generator = function(config) { return new Promise( function(resolve, reject) { fs.ensureDirSync(post.meta.urlObj.dirname()); - var promises = [ + let promises = [ fs.writeFileAsync(post.meta.urlObj.filename(), Mustache.renderExtra(Mustache.themeTemplates.postHtml, { post: post, config: config @@ -180,15 +180,15 @@ var Generator = function(config) { return false; } // Target directory - var sourceDirectory = post.filename.replace(/\.md$/, '') + "/"; // Source directory - var sourceGlob = glob.sync(sourceDirectory + "*.{png,jpg,gif}"); - var sourceReg = new RegExp(sourceDirectory); - var imageStyles = sourceGlob ? post.getAllImagesWithStyleObject() : {}; + let sourceDirectory = post.filename.replace(/\.md$/, '') + "/"; // Source directory + let sourceGlob = glob.sync(sourceDirectory + "*.{png,jpg,gif}"); + let sourceReg = new RegExp(sourceDirectory); + let imageStyles = sourceGlob ? post.getAllImagesWithStyleObject() : {}; return new Promise( function(resolve, reject) { - var promises = sourceGlob.map(function(sourceFile) { - var targetFile = sourceFile.replace(sourceReg, config.directories.htdocs + post.meta.Url); + let promises = sourceGlob.map(function(sourceFile) { + let targetFile = sourceFile.replace(sourceReg, config.directories.htdocs + post.meta.Url); fs.copySync(sourceFile, targetFile); //console.log(imageStyles[path.basename(sourceFile)] || []); return internal.imageStyles.generateImagesWithStyles(sourceFile, targetFile, imageStyles[path.basename(sourceFile)] || []); @@ -196,7 +196,7 @@ var Generator = function(config) { Promise .all(promises) .then(function(generatedImages) { - var processed = 0; + let processed = 0; if (promises.length > 0) { processed = generatedImages.reduce(function(accumulatedValue, generatedImage) { return accumulatedValue + generatedImage; @@ -218,7 +218,7 @@ var Generator = function(config) { external.buildSpecialPages = function() { return new Promise( function(resolve, reject) { - var promises = [ + let promises = [ external.buildIndexFiles(), external.buildTagPages(), external.buildMetaFiles() @@ -254,9 +254,9 @@ var Generator = function(config) { return new Promise( function(resolve, reject) { - var page; - var pagedPosts = index.getPagedPosts(config.itemsPerPage); - var urls = { + let page; + let pagedPosts = index.getPagedPosts(config.itemsPerPage); + let urls = { indexHtml: indexUrl(path + 'index.html'), rss: indexUrl(path + 'posts.rss'), jsonrss: indexUrl(path + 'rss.json'), @@ -270,8 +270,8 @@ var Generator = function(config) { ics: indexUrl(path + 'posts.ics'), ajax: indexUrl(path + 'index.json') }; - var promises = []; - var pubDate = blogophonDate(index.pubDate); + let promises = []; + let pubDate = blogophonDate(index.pubDate); if (config.specialFeatures.rss || config.specialFeatures.facebookinstantarticles) { promises.push(fs.writeFileAsync( urls.rss.filename(), Mustache.render(Mustache.templates.rssXml, { index: index.getPosts(10), @@ -349,8 +349,8 @@ var Generator = function(config) { } for (page = 0; page < pagedPosts.length; page ++) { - var curPageObj = index.getPageData(page, pagedPosts.length, false, path); - var curUrlObj = indexUrl(curPageObj.currentUrl); + let curPageObj = index.getPageData(page, pagedPosts.length, false, path); + let curUrlObj = indexUrl(curPageObj.currentUrl); curPageObj.index = pagedPosts[page]; curPageObj.config = config; curPageObj.meta = { @@ -404,8 +404,8 @@ var Generator = function(config) { * @return {Promise} with first parameter of `resolve` being the number of files converted. */ external.buildTagPages = function() { - var tags = internal.currentIndex.getTags(); - var tagPages = Object.keys(tags).sort().map(function(key) { + let tags = internal.currentIndex.getTags(); + let tagPages = Object.keys(tags).sort().map(function(key) { return { title: tags[key].title, url: tags[key].urlObj.relativeUrl() @@ -417,7 +417,7 @@ var Generator = function(config) { return new Promise( function(resolve, reject) { - var promises = Object.keys(tags).map(function(key) { + let promises = Object.keys(tags).map(function(key) { return external.buildIndexFiles( tags[key].index, '/'+tags[key].urlObj.relativeDirname()+'/', @@ -453,8 +453,8 @@ var Generator = function(config) { * @return {Promise} with first parameter of `resolve` being the number of files converted. */ external.buildAuthorPages = function() { - var authors = internal.currentIndex.getAuthors(); - var authorPages = Object.keys(authors).sort().map(function(name) { + let authors = internal.currentIndex.getAuthors(); + let authorPages = Object.keys(authors).sort().map(function(name) { return { title: name, url: authors[name].urlObj.relativeUrl() @@ -469,7 +469,7 @@ var Generator = function(config) { } fs.ensureDirSync(path.join(config.directories.htdocs, config.htdocs.author)); - var promises = Object.keys(authors).map(function(name) { + let promises = Object.keys(authors).map(function(name) { return external.buildIndexFiles( authors[name].index, '/'+authors[name].urlObj.relativeDirname()+'/', @@ -512,7 +512,7 @@ var Generator = function(config) { external.buildMetaFiles = function() { return new Promise( function(resolve, reject) { - var promises = [ + let promises = [ fs.writeFileAsync( indexUrl('404.html').filename(), Mustache.renderExtra( @@ -591,7 +591,7 @@ var Generator = function(config) { * @return {Boolean} [description] */ external.deploy = function() { - var shell = require('shelljs'); + let shell = require('shelljs'); if (config.deployCmd) { console.log('Deploying...'); shell.exec('cd '+path.join(__dirname, '..')+'; ' + config.deployCmd); diff --git a/src/helpers/ampify.js b/src/helpers/ampify.js index 346ffc28..5169b137 100644 --- a/src/helpers/ampify.js +++ b/src/helpers/ampify.js @@ -1,7 +1,7 @@ 'use strict'; -var ampify = function() { - var external = {}; +const ampify = function() { + const external = {}; /** * Convert regular HTML in AMP-HTML. @@ -24,8 +24,8 @@ var ampify = function() { .replace(/( (width)="[^"]*")([^>]* \2="[^"]*")/g, '$3') .replace(/(]+) allowfullscreen=".+?"/g, '$1') .replace(/