From 9235f44dc1377ac6b3f9a69831a3bca1ecd098c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=BChnel?= Date: Wed, 13 Feb 2019 21:26:58 +0100 Subject: [PATCH] chore: Reformat code using the latest settings --- build/config.js | 36 +- build/handlebars.js | 182 +++++----- build/webpack.config.babel.js | 32 +- build/webpack/config.dev-server.js | 22 +- build/webpack/config.entry.js | 22 +- build/webpack/config.module.rules.js | 113 ++++--- build/webpack/config.optimization.js | 44 +-- build/webpack/config.output.js | 18 +- build/webpack/config.plugins.js | 126 +++---- build/webpack/config.stats.js | 10 +- build/webpack/helpers.js | 4 +- postcss.config.js | 21 +- src/app/__tests__/dummy-test.js | 8 +- src/app/base/base.js | 82 ++--- src/app/base/polyfills.js | 76 ++--- src/app/index.js | 10 +- src/assets/scss/_print.scss | 62 ++-- src/assets/scss/_variables.scss | 5 +- src/assets/scss/theme/_alerts.scss | 24 +- src/assets/scss/theme/_footer.scss | 66 ++-- src/assets/scss/theme/_mixins.scss | 8 +- src/assets/scss/theme/_scaffolding.scss | 32 +- .../scss/theme/_testResponsiveHelpers.scss | 316 +++++++++--------- src/handlebars/helpers/add-year.js | 2 +- 24 files changed, 685 insertions(+), 636 deletions(-) diff --git a/build/config.js b/build/config.js index 8d151c0..2a90848 100644 --- a/build/config.js +++ b/build/config.js @@ -11,25 +11,25 @@ export const { useHandlebars } = configFile; export const { generateBanners } = configFile; export const mainDirectories = { - dev: '../server/', - prod: '../dist/', - src: '../src' + dev: '../server/', + prod: '../dist/', + src: '../src' }; export const settings = { - sources: { - handlebars: './src/handlebars/', - app: './src/app/', - appTemplates: { - directory: './src/app', - files: '**/*.html' - }, - assets: './src/assets' - }, - destinations: { - handlebars: './.metalsmith-build', - assets: 'assets', - appTemplates: 'app', - vendorFiles: 'assets/vendor' - } + sources: { + handlebars: './src/handlebars/', + app: './src/app/', + appTemplates: { + directory: './src/app', + files: '**/*.html' + }, + assets: './src/assets' + }, + destinations: { + handlebars: './.metalsmith-build', + assets: 'assets', + appTemplates: 'app', + vendorFiles: 'assets/vendor' + } }; diff --git a/build/handlebars.js b/build/handlebars.js index 8b85701..dd89ca9 100644 --- a/build/handlebars.js +++ b/build/handlebars.js @@ -17,97 +17,121 @@ import { settings, useHandlebars } from './config'; perfy.start('build', false); if (!useHandlebars) { - process.exit(0); + process.exit(0); } metalsmith(__dirname) - // Source directory - .source('../src') + // Source directory + .source('../src') - // Destination directory - .destination(path.join(__dirname, '../', settings.destinations.handlebars)) + // Destination directory + .destination(path.join(__dirname, '../', settings.destinations.handlebars)) - // Clean destination before - .clean(true) + // Clean destination before + .clean(true) - // Register Handlebars helpers - .use( - registerHelpers({ - directory: path.join(__dirname, '../', settings.sources.handlebars, 'helpers') - }) - ) + // Register Handlebars helpers + .use( + registerHelpers({ + directory: path.join( + __dirname, + '../', + settings.sources.handlebars, + 'helpers' + ) + }) + ) - // Register Handlebars partials - .use( - registerPartials({ - directory: path.join(__dirname, '../', settings.sources.handlebars, 'partials'), - pattern: /\.hbs$/ - }) - ) + // Register Handlebars partials + .use( + registerPartials({ + directory: path.join( + __dirname, + '../', + settings.sources.handlebars, + 'partials' + ), + pattern: /\.hbs$/ + }) + ) - // Wrap layouts around content pages - .use( - layouts({ - directory: path.join(__dirname, '../', settings.sources.handlebars, 'layouts'), - default: 'default.hbs', - pattern: '**/*.hbs' - }) - ) + // Wrap layouts around content pages + .use( + layouts({ + directory: path.join( + __dirname, + '../', + settings.sources.handlebars, + 'layouts' + ), + default: 'default.hbs', + pattern: '**/*.hbs' + }) + ) - // Render handlebars content pages - .use( - inPlace({ - engineOptions: { - pattern: '*.hbs', - partials: path.join(__dirname, '../', settings.sources.handlebars, 'partials') - } - }) - ) + // Render handlebars content pages + .use( + inPlace({ + engineOptions: { + pattern: '*.hbs', + partials: path.join( + __dirname, + '../', + settings.sources.handlebars, + 'partials' + ) + } + }) + ) - // Only build HTML files - .use(filter(['**/*.html', 'handlebars'])) + // Only build HTML files + .use(filter(['**/*.html', 'handlebars'])) - // Finally build files - .build(err => { - // Handle build errors - if (err) { - console.log(stripIndents` + // Finally build files + .build(err => { + // Handle build errors + if (err) { + console.log(stripIndents` ${logSymbols.error} Handlebars build failed: ${chalk.red.bold(err.message)} `); - process.exit(1); - } else { - // Handle successful build - /** - * NOTE: - * We need to backdate the generated files by ten seconds until - * https://github.com/webpack/watchpack/issues/25 is fixed. - * Otherwise we would have some unneeded rebuilds when starting webpack in - * watch mode or starting the webpack dev server. - */ - const f = path.resolve(__dirname, '../', settings.destinations.handlebars); - const now = Date.now() / 1000; - const then = now - 10; - globby(f + '/**/*.html').then(files => { - files.forEach(file => { - fs.utimes(file, then, then, err => { - if (err) { - console.error(err); - } + process.exit(1); + } else { + // Handle successful build + /** + * NOTE: + * We need to backdate the generated files by ten seconds until + * https://github.com/webpack/watchpack/issues/25 is fixed. + * Otherwise we would have some unneeded rebuilds when starting webpack in + * watch mode or starting the webpack dev server. + */ + const f = path.resolve( + __dirname, + '../', + settings.destinations.handlebars + ); + const now = Date.now() / 1000; + const then = now - 10; + globby(f + '/**/*.html').then(files => { + files.forEach(file => { + fs.utimes(file, then, then, err => { + if (err) { + console.error(err); + } - console.log( - logSymbols.success, - `Finished ${chalk.blue.bold('Handlebars build')} after`, - chalk.yellow.bold( - perfy.end('build').time >= 1 - ? `${Math.round(perfy.end('build').time * 100) / 100} s` - : `${Math.round(perfy.end('build').milliseconds)} ms` - ), - '\n' - ); - process.exit(0); - }); - }); - }); - } - }); + console.log( + logSymbols.success, + `Finished ${chalk.blue.bold('Handlebars build')} after`, + chalk.yellow.bold( + perfy.end('build').time >= 1 + ? `${Math.round(perfy.end('build').time * 100) / 100} s` + : `${Math.round(perfy.end('build').milliseconds)} ms` + ), + '\n' + ); + process.exit(0); + }); + }); + }); + } + }); diff --git a/build/webpack.config.babel.js b/build/webpack.config.babel.js index fdc18a5..ac305d0 100644 --- a/build/webpack.config.babel.js +++ b/build/webpack.config.babel.js @@ -15,24 +15,24 @@ const cliFlags = minimist(process.argv.slice(2)); const buildTarget = isDevMode() ? ' Development ' : ' Production '; if (!cliFlags.json) { - console.log( - chalk.yellow(stripIndents`Build target: ${chalk.bold.inverse(buildTarget)} + console.log( + chalk.yellow(stripIndents`Build target: ${chalk.bold.inverse(buildTarget)} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`) - ); + ); } module.exports = { - devServer, - /** - * The accuracy of sourcemaps affects build times. - * See https://webpack.js.org/configuration/devtool/ if you need to speed up your builds. - */ - devtool: isDevMode() ? 'inline-cheap-module-source-map' : false, - entry, - module: { rules }, - output, - plugins, - optimization, - mode: isDevMode() ? 'development' : 'production', - stats + devServer, + /** + * The accuracy of sourcemaps affects build times. + * See https://webpack.js.org/configuration/devtool/ if you need to speed up your builds. + */ + devtool: isDevMode() ? 'inline-cheap-module-source-map' : false, + entry, + module: { rules }, + output, + plugins, + optimization, + mode: isDevMode() ? 'development' : 'production', + stats }; diff --git a/build/webpack/config.dev-server.js b/build/webpack/config.dev-server.js index b920025..fd45f17 100644 --- a/build/webpack/config.dev-server.js +++ b/build/webpack/config.dev-server.js @@ -5,15 +5,15 @@ import { isDevMode } from './helpers'; import { stats } from './config.stats'; export const devServer = { - contentBase: isDevMode() - ? path.join(__dirname, '../', mainDirectories.dev) - : path.join(__dirname, '../', mainDirectories.prod), - port: isDevMode() ? 3000 : 3001, - overlay: true, - stats: { - version: false, - assets: false, - modules: false, - ...stats - } + contentBase: isDevMode() + ? path.join(__dirname, '../', mainDirectories.dev) + : path.join(__dirname, '../', mainDirectories.prod), + port: isDevMode() ? 3000 : 3001, + overlay: true, + stats: { + version: false, + assets: false, + modules: false, + ...stats + } }; diff --git a/build/webpack/config.entry.js b/build/webpack/config.entry.js index 75910cc..c0516c2 100644 --- a/build/webpack/config.entry.js +++ b/build/webpack/config.entry.js @@ -5,18 +5,20 @@ import { settings } from '../config'; const configFile = require('../../baumeister.json'); export const entry = { - app: `${path.join(__dirname, '../../', settings.sources.app)}index.js`, - ...getVendorCSS() + app: `${path.join(__dirname, '../../', settings.sources.app)}index.js`, + ...getVendorCSS() }; function getVendorCSS() { - // Return flattened array of resolved globs from baumeister.json - const vendorCSS = [].concat( - ...configFile.vendor.bundleCSS.map(glob => globby.sync(`./node_modules/${glob}`)) - ); - if (!vendorCSS.length) { - return false; - } + // Return flattened array of resolved globs from baumeister.json + const vendorCSS = [].concat( + ...configFile.vendor.bundleCSS.map(glob => + globby.sync(`./node_modules/${glob}`) + ) + ); + if (!vendorCSS.length) { + return false; + } - return { vendor: vendorCSS }; + return { vendor: vendorCSS }; } diff --git a/build/webpack/config.module.rules.js b/build/webpack/config.module.rules.js index 83889c5..05f8d71 100644 --- a/build/webpack/config.module.rules.js +++ b/build/webpack/config.module.rules.js @@ -7,57 +7,64 @@ import { isDevMode } from './helpers'; const configFile = require('../../baumeister.json'); export const rules = [ - { - test: /\.(js|jsx)$/, - include: path.resolve(__dirname, '../../', settings.sources.app), - exclude: /(node_modules)/, - loader: 'babel-loader', - options: { - sourceMap: isDevMode() - } - }, - { - test: /\.css$/, - use: [MiniCssExtractPlugin.loader, 'css-loader'] - }, - { - test: /\.scss$/, - use: [ - MiniCssExtractPlugin.loader, - { loader: 'css-loader', options: { sourceMap: isDevMode() } }, - { - loader: 'postcss-loader', - options: { - sourceMap: isDevMode(), - config: { - ctx: { - usePurifyCSS: configFile.purifyCSS.usePurifyCSS, - cssnano: { - discardComments: { - removeAll: true - } - }, - autoprefixer: { - browsers: ['> 1%', 'last 3 version', 'ie 8', 'ie 9', 'Firefox ESR', 'Opera 12.1'] - } - } - } - } - }, - { loader: 'sass-loader', options: { sourceMap: isDevMode() } } - ] - }, - { - test: /\.(woff(2)?|ttf|eot|svg|png|gif|jpe?g)(\?v=\d+\.\d+\.\d+)?$/, - use: [ - { - loader: 'file-loader', - options: { - outputPath: '../', - useRelativePath: true, - name: '[name].[ext]' - } - } - ] - } + { + test: /\.(js|jsx)$/, + include: path.resolve(__dirname, '../../', settings.sources.app), + exclude: /(node_modules)/, + loader: 'babel-loader', + options: { + sourceMap: isDevMode() + } + }, + { + test: /\.css$/, + use: [MiniCssExtractPlugin.loader, 'css-loader'] + }, + { + test: /\.scss$/, + use: [ + MiniCssExtractPlugin.loader, + { loader: 'css-loader', options: { sourceMap: isDevMode() } }, + { + loader: 'postcss-loader', + options: { + sourceMap: isDevMode(), + config: { + ctx: { + usePurifyCSS: configFile.purifyCSS.usePurifyCSS, + cssnano: { + discardComments: { + removeAll: true + } + }, + autoprefixer: { + browsers: [ + '> 1%', + 'last 3 version', + 'ie 8', + 'ie 9', + 'Firefox ESR', + 'Opera 12.1' + ] + } + } + } + } + }, + { loader: 'sass-loader', options: { sourceMap: isDevMode() } } + ] + }, + { + test: /\.(woff(2)?|ttf|eot|svg|png|gif|jpe?g)(\?v=\d+\.\d+\.\d+)?$/, + use: [ + { + loader: 'file-loader', + options: { + outputPath: '../', + useRelativePath: true, + name: '[name].[ext]' + } + } + ] + } ]; diff --git a/build/webpack/config.optimization.js b/build/webpack/config.optimization.js index 9b3d325..dc4e0b2 100644 --- a/build/webpack/config.optimization.js +++ b/build/webpack/config.optimization.js @@ -1,26 +1,26 @@ import UglifyJSPlugin from 'uglifyjs-webpack-plugin'; export const optimization = { - runtimeChunk: { - name: 'runtime' - }, - splitChunks: { - cacheGroups: { - commons: { - test: /[\\/]node_modules[\\/]/, - name: 'vendor', - chunks: 'all' - } - } - }, - minimizer: [ - new UglifyJSPlugin({ - uglifyOptions: { - compress: { - drop_console: true, // eslint-disable-line camelcase - drop_debugger: true // eslint-disable-line camelcase - } - } - }) - ] + runtimeChunk: { + name: 'runtime' + }, + splitChunks: { + cacheGroups: { + commons: { + test: /[\\/]node_modules[\\/]/, + name: 'vendor', + chunks: 'all' + } + } + }, + minimizer: [ + new UglifyJSPlugin({ + uglifyOptions: { + compress: { + drop_console: true, // eslint-disable-line camelcase + drop_debugger: true // eslint-disable-line camelcase + } + } + }) + ] }; diff --git a/build/webpack/config.output.js b/build/webpack/config.output.js index 56d2019..ab04d9b 100644 --- a/build/webpack/config.output.js +++ b/build/webpack/config.output.js @@ -5,12 +5,14 @@ import { isDevMode } from './helpers'; const configFile = require('../../baumeister.json'); export const output = { - path: isDevMode() - ? path.join(__dirname, '../', mainDirectories.dev) - : path.join(__dirname, '../', mainDirectories.prod), - filename: configFile.cacheBusting ? 'app/[name].[chunkhash].bundle.js' : 'app/[name].bundle.js', - chunkFilename: configFile.cacheBusting - ? 'app/[name].[chunkhash].bundle.js' - : 'app/[name].bundle.js', - publicPath: '/' + path: isDevMode() + ? path.join(__dirname, '../', mainDirectories.dev) + : path.join(__dirname, '../', mainDirectories.prod), + filename: configFile.cacheBusting + ? 'app/[name].[chunkhash].bundle.js' + : 'app/[name].bundle.js', + chunkFilename: configFile.cacheBusting + ? 'app/[name].[chunkhash].bundle.js' + : 'app/[name].bundle.js', + publicPath: '/' }; diff --git a/build/webpack/config.plugins.js b/build/webpack/config.plugins.js index 8343f97..8a62acc 100644 --- a/build/webpack/config.plugins.js +++ b/build/webpack/config.plugins.js @@ -15,67 +15,69 @@ const pkg = require('../../package.json'); const configFile = require('../../baumeister.json'); const manifest = new WebpackAssetsManifest({ - output: path.resolve('.webpack-assets.json') + output: path.resolve('.webpack-assets.json') }); const copyVendorFiles = configFile.vendor.includeStaticFiles.map(glob => { - return { - from: glob, - context: 'node_modules', - to: settings.destinations.vendorFiles - }; + return { + from: glob, + context: 'node_modules', + to: settings.destinations.vendorFiles + }; }); const purifyCSSOptions = { - paths: globby.sync(path.join(settings.destinations.handlebars, '**/*.html')), - purifyOptions: { - minify: true, - cleanCssOptions: { level: { 1: { specialComments: 0 } } }, - whitelist: configFile.purifyCSS.whitelist - } + paths: globby.sync(path.join(settings.destinations.handlebars, '**/*.html')), + purifyOptions: { + minify: true, + cleanCssOptions: { level: { 1: { specialComments: 0 } } }, + whitelist: configFile.purifyCSS.whitelist + } }; /** * Plugins used for development and production builds */ const generalPlugins = [ - manifest, - new MiniCssExtractPlugin({ - filename: - configFile.cacheBusting && isProdMode() - ? 'assets/css/[name].[chunkhash].bundle.css' - : 'assets/css/[name].bundle.css' - }), - new webpack.ProvidePlugin({ ...configFile.webpack.ProvidePlugin }), - new CopyWebpackPlugin([ - { - from: '**/*.html', - context: useHandlebars ? settings.destinations.handlebars : './src', - transform(content) { - return content.toString().replace(/@@(.*\.css|.*\.js)/g, (match, $1) => { - if (!($1 in manifest.assets)) { - return ``; - } + manifest, + new MiniCssExtractPlugin({ + filename: + configFile.cacheBusting && isProdMode() + ? 'assets/css/[name].[chunkhash].bundle.css' + : 'assets/css/[name].bundle.css' + }), + new webpack.ProvidePlugin({ ...configFile.webpack.ProvidePlugin }), + new CopyWebpackPlugin([ + { + from: '**/*.html', + context: useHandlebars ? settings.destinations.handlebars : './src', + transform(content) { + return content + .toString() + .replace(/@@(.*\.css|.*\.js)/g, (match, $1) => { + if (!($1 in manifest.assets)) { + return ``; + } - return /\.css/g.test($1) - ? `` - : ``; - }); - } - }, - { - from: '**/*', - context: settings.sources.assets, - to: settings.destinations.assets, - ignore: ['scss/**'] - }, - ...copyVendorFiles - ]), - new webpack.DefinePlugin( - isDevMode() - ? { ...configFile.webpack.DefinePlugin.development } - : { ...configFile.webpack.DefinePlugin.production } - ) + return /\.css/g.test($1) + ? `` + : ``; + }); + } + }, + { + from: '**/*', + context: settings.sources.assets, + to: settings.destinations.assets, + ignore: ['scss/**'] + }, + ...copyVendorFiles + ]), + new webpack.DefinePlugin( + isDevMode() + ? { ...configFile.webpack.DefinePlugin.development } + : { ...configFile.webpack.DefinePlugin.production } + ) ]; /** @@ -87,19 +89,25 @@ const devPlugins = []; * Plugins used for production builds only */ const prodPlugins = [ - new webpack.HashedModuleIdsPlugin(), - new ImageminPlugin({ test: /\.(jpe?g|png|gif|svg)$/i }), - configFile.purifyCSS.usePurifyCSS ? new PurifyCSSPlugin(purifyCSSOptions) : false, - generateBanners - ? new webpack.BannerPlugin({ - banner: stripIndents`${pkg.title} - v${pkg.version} + new webpack.HashedModuleIdsPlugin(), + new ImageminPlugin({ test: /\.(jpe?g|png|gif|svg)$/i }), + configFile.purifyCSS.usePurifyCSS + ? new PurifyCSSPlugin(purifyCSSOptions) + : false, + generateBanners + ? new webpack.BannerPlugin({ + banner: stripIndents`${pkg.title} - v${pkg.version} ${pkg.author.email} Copyright ©${new Date().getFullYear()} ${pkg.author.name} - ${new Date().toLocaleDateString('en-US', { day: '2-digit', month: 'long', year: 'numeric' })}` - }) - : false + ${new Date().toLocaleDateString('en-US', { + day: '2-digit', + month: 'long', + year: 'numeric' + })}` + }) + : false ].filter(Boolean); export const plugins = isDevMode() - ? [...generalPlugins, ...devPlugins] - : [...generalPlugins, ...prodPlugins]; + ? [...generalPlugins, ...devPlugins] + : [...generalPlugins, ...prodPlugins]; diff --git a/build/webpack/config.stats.js b/build/webpack/config.stats.js index 54c70ce..b9b1657 100644 --- a/build/webpack/config.stats.js +++ b/build/webpack/config.stats.js @@ -1,7 +1,7 @@ export const stats = { - timings: true, - hash: false, - builtAt: false, - entrypoints: false, - children: false + timings: true, + hash: false, + builtAt: false, + entrypoints: false, + children: false }; diff --git a/build/webpack/helpers.js b/build/webpack/helpers.js index 384588f..f0301cf 100644 --- a/build/webpack/helpers.js +++ b/build/webpack/helpers.js @@ -1,7 +1,7 @@ export const isDevMode = function() { - return process.env.NODE_ENV === 'development'; + return process.env.NODE_ENV === 'development'; }; export const isProdMode = function() { - return process.env.NODE_ENV === 'production'; + return process.env.NODE_ENV === 'production'; }; diff --git a/postcss.config.js b/postcss.config.js index e881bd0..2058383 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,11 +1,14 @@ module.exports = ({ file, options, env }) => ({ - plugins: { - autoprefixer: options.autoprefixer, - /** - * Need to disable minification when using PurifyCSS because using PurifyCSS - * on minified CSS disn’t work out. PurifyCSS has a minify option wich is - * used instead. - */ - cssnano: env === 'production' && options.usePurifyCSS === false ? options.cssnano : false - } + plugins: { + autoprefixer: options.autoprefixer, + /** + * Need to disable minification when using PurifyCSS because using PurifyCSS + * on minified CSS disn’t work out. PurifyCSS has a minify option wich is + * used instead. + */ + cssnano: + env === 'production' && options.usePurifyCSS === false + ? options.cssnano + : false + } }); diff --git a/src/app/__tests__/dummy-test.js b/src/app/__tests__/dummy-test.js index 2fe1b04..7efa352 100644 --- a/src/app/__tests__/dummy-test.js +++ b/src/app/__tests__/dummy-test.js @@ -8,11 +8,11 @@ let one; beforeAll(() => { - one = 1; + one = 1; }); describe('Dummy', () => { - it('has a test', () => { - expect(one).toBeTruthy(); - }); + it('has a test', () => { + expect(one).toBeTruthy(); + }); }); diff --git a/src/app/base/base.js b/src/app/base/base.js index fe300cf..8f9e412 100644 --- a/src/app/base/base.js +++ b/src/app/base/base.js @@ -7,11 +7,13 @@ * @see {@link http://getbootstrap.com/getting-started/#support-ie10-width} */ export function ieViewportFix() { - if (navigator.userAgent.match(/IEMobile\/10\.0/)) { - const msViewportStyle = document.createElement('style'); - msViewportStyle.append(document.createTextNode('@-ms-viewport{width:auto!important}')); - document.querySelector('head').append(msViewportStyle); - } + if (navigator.userAgent.match(/IEMobile\/10\.0/)) { + const msViewportStyle = document.createElement('style'); + msViewportStyle.append( + document.createTextNode('@-ms-viewport{width:auto!important}') + ); + document.querySelector('head').append(msViewportStyle); + } } /** @@ -19,42 +21,42 @@ export function ieViewportFix() { * @see {@link https://github.com/h5bp/html5-boilerplate/blob/master/js/plugins.js} */ export function consoleErrorFix() { - let method; - const noOp = function() {}; + let method; + const noOp = function() {}; - const methods = [ - 'assert', - 'clear', - 'count', - 'debug', - 'dir', - 'dirxml', - 'error', - 'exception', - 'group', - 'groupCollapsed', - 'groupEnd', - 'info', - 'log', - 'markTimeline', - 'profile', - 'profileEnd', - 'table', - 'time', - 'timeEnd', - 'timeStamp', - 'trace', - 'warn' - ]; - let length = methods.length; - const console = window.console || {}; + const methods = [ + 'assert', + 'clear', + 'count', + 'debug', + 'dir', + 'dirxml', + 'error', + 'exception', + 'group', + 'groupCollapsed', + 'groupEnd', + 'info', + 'log', + 'markTimeline', + 'profile', + 'profileEnd', + 'table', + 'time', + 'timeEnd', + 'timeStamp', + 'trace', + 'warn' + ]; + let length = methods.length; + const console = window.console || {}; - while (length--) { - method = methods[length]; + while (length--) { + method = methods[length]; - // Only stub undefined methods. - if (!console[method]) { - console[method] = noOp; - } - } + // Only stub undefined methods. + if (!console[method]) { + console[method] = noOp; + } + } } diff --git a/src/app/base/polyfills.js b/src/app/base/polyfills.js index 1380a38..1354eaf 100644 --- a/src/app/base/polyfills.js +++ b/src/app/base/polyfills.js @@ -33,55 +33,55 @@ import 'promise-polyfill/src/polyfill'; */ export const applyPolyfills = () => { - const polyfills = []; + const polyfills = []; - /** - * Globals - */ + /** + * Globals + */ - // if (typeof Object.assign !== 'function') { - // polyfills.push(import(/* webpackChunkName: "Object.assign" */ 'core-js/fn/object/assign')); - // } + // if (typeof Object.assign !== 'function') { + // polyfills.push(import(/* webpackChunkName: "Object.assign" */ 'core-js/fn/object/assign')); + // } - // if (!window.Set) { - // polyfills.push(import(/* webpackChunkName: "set" */ 'core-js/es6/set')); - // } + // if (!window.Set) { + // polyfills.push(import(/* webpackChunkName: "set" */ 'core-js/es6/set')); + // } - // if (!window.Map) { - // polyfills.push(import(/* webpackChunkName: "map" */ 'core-js/es6/map')); - // } + // if (!window.Map) { + // polyfills.push(import(/* webpackChunkName: "map" */ 'core-js/es6/map')); + // } - /** - * Array prototype methods - */ + /** + * Array prototype methods + */ - // if (!Array.prototype.includes) { - // polyfills.push(import(/* webpackChunkName: "Array.prototype.includes" */ 'core-js/fn/array/includes')); - // } + // if (!Array.prototype.includes) { + // polyfills.push(import(/* webpackChunkName: "Array.prototype.includes" */ 'core-js/fn/array/includes')); + // } - // if (!Array.prototype.find) { - // polyfills.push(import(/* webpackChunkName: "Array.prototype.find" */ 'core-js/fn/array/find')); - // } + // if (!Array.prototype.find) { + // polyfills.push(import(/* webpackChunkName: "Array.prototype.find" */ 'core-js/fn/array/find')); + // } - /** - * String prototype methods - */ + /** + * String prototype methods + */ - // if (!String.prototype.includes) { - // polyfills.push(import(/* webpackChunkName: "String.prototype.includes" */ 'core-js/fn/string/includes')); - // } + // if (!String.prototype.includes) { + // polyfills.push(import(/* webpackChunkName: "String.prototype.includes" */ 'core-js/fn/string/includes')); + // } - // if (!String.prototype.startsWith) { - // polyfills.push(import(/* webpackChunkName: "String.prototype.startsWith" */ 'core-js/fn/string/starts-with')); - // } + // if (!String.prototype.startsWith) { + // polyfills.push(import(/* webpackChunkName: "String.prototype.startsWith" */ 'core-js/fn/string/starts-with')); + // } - // if (!String.prototype.trimStart) { - // polyfills.push(import(/* webpackChunkName: "String.prototype.trimStart" */ 'core-js/fn/string/trim-start')); - // } + // if (!String.prototype.trimStart) { + // polyfills.push(import(/* webpackChunkName: "String.prototype.trimStart" */ 'core-js/fn/string/trim-start')); + // } - // if (!String.prototype.trimEnd) { - // polyfills.push(import(/* webpackChunkName: "String.prototype.trimEnd" */ 'core-js/fn/string/trim-end')); - // } + // if (!String.prototype.trimEnd) { + // polyfills.push(import(/* webpackChunkName: "String.prototype.trimEnd" */ 'core-js/fn/string/trim-end')); + // } - return Promise.all(polyfills); + return Promise.all(polyfills); }; diff --git a/src/app/index.js b/src/app/index.js index 4501556..ce93297 100644 --- a/src/app/index.js +++ b/src/app/index.js @@ -19,11 +19,11 @@ import { consoleErrorFix, ieViewportFix } from './base/base'; import '../assets/scss/index.scss'; $(async () => { - // Wait with further execution until needed polyfills are loaded. - await applyPolyfills(); + // Wait with further execution until needed polyfills are loaded. + await applyPolyfills(); - consoleErrorFix(); - ieViewportFix(); + consoleErrorFix(); + ieViewportFix(); - console.log('YaY, my first ES6-Module !!!!'); + console.log('YaY, my first ES6-Module !!!!'); }); diff --git a/src/assets/scss/_print.scss b/src/assets/scss/_print.scss index c9633c7..75a3bb2 100644 --- a/src/assets/scss/_print.scss +++ b/src/assets/scss/_print.scss @@ -2,42 +2,42 @@ // -------------------------------------------------- @page { - size: auto; - margin: 2cm 1cm; + size: auto; + margin: 2cm 1cm; } @media print { - body { - font-family: Garamond, Georgia, 'Times New Roman', serif; - background: white; - font-size: 90%; - line-height: 115%; - letter-spacing: -0.15em; - color: #404040; - } + body { + font-family: Garamond, Georgia, 'Times New Roman', serif; + background: white; + font-size: 90%; + line-height: 115%; + letter-spacing: -0.15em; + color: #404040; + } - [role='navigation'], - aside, - img, - nav { - display: none; - } + [role='navigation'], + aside, + img, + nav { + display: none; + } - h1 { - font-size: 140%; - } + h1 { + font-size: 140%; + } - body, - footer, - main { - clear: both; - float: none; - width: 100%; - margin: 0; - padding: 0; - } + body, + footer, + main { + clear: both; + float: none; + width: 100%; + margin: 0; + padding: 0; + } - a { - text-decoration: none; - } + a { + text-decoration: none; + } } diff --git a/src/assets/scss/_variables.scss b/src/assets/scss/_variables.scss index bb9c5e8..5d4fd67 100644 --- a/src/assets/scss/_variables.scss +++ b/src/assets/scss/_variables.scss @@ -12,8 +12,9 @@ // font-size: @font-size-base - 1; // } // } -$retina: '(-webkit-min-device-pixel-ratio: 1.5)', '(min--moz-device-pixel-ratio: 1.5)', - '(-o-min-device-pixel-ratio: 3/2)', '(min-device-pixel-ratio: 1.5)'; +$retina: '(-webkit-min-device-pixel-ratio: 1.5)', + '(min--moz-device-pixel-ratio: 1.5)', '(-o-min-device-pixel-ratio: 3/2)', + '(min-device-pixel-ratio: 1.5)'; $xs-only: 'only screen and (max-width: $screen-xs-max)'; $sm-only: 'only screen and (min-width: $screen-xs-min) and (max-width: $screen-sm-max)'; $md-only: 'only screen and (min-width: $screen-sm-min) and (max-width: $screen-md-max)'; diff --git a/src/assets/scss/theme/_alerts.scss b/src/assets/scss/theme/_alerts.scss index 1e6df61..5dd4c0d 100644 --- a/src/assets/scss/theme/_alerts.scss +++ b/src/assets/scss/theme/_alerts.scss @@ -4,18 +4,18 @@ // Just an example for overriding bootstraps alerts.scss file .alert { - // Local variables - // - // Which are meant to be used only in this module. »Global« variables are stored - // in /src/assets/scss/_variables.scss - $alert-border-radius: 4px; + // Local variables + // + // Which are meant to be used only in this module. »Global« variables are stored + // in /src/assets/scss/_variables.scss + $alert-border-radius: 4px; - // Local mixins - // - // Which are meant to be used only in this module. »Global« mixins are stored - // in /src/assets/scss/theme/_mixins.scss + // Local mixins + // + // Which are meant to be used only in this module. »Global« mixins are stored + // in /src/assets/scss/theme/_mixins.scss - // Styles - // - border-radius: $alert-border-radius; + // Styles + // + border-radius: $alert-border-radius; } diff --git a/src/assets/scss/theme/_footer.scss b/src/assets/scss/theme/_footer.scss index 078c8b0..5ba91a2 100644 --- a/src/assets/scss/theme/_footer.scss +++ b/src/assets/scss/theme/_footer.scss @@ -14,46 +14,46 @@ $footer-text-margin: 20px; // Called in _scaffolding.scss @mixin footer-htmlProps { - position: relative; - min-height: 100%; + position: relative; + min-height: 100%; } // Called in _scaffolding.scss @mixin footer-bodyProps { - // Margin bottom by footer height - margin-bottom: ($footer-height - $footer-text-margin); + // Margin bottom by footer height + margin-bottom: ($footer-height - $footer-text-margin); } // Module wrapper .footer { - // Local variables - // - // Which are meant to be used only in this module. »Global« variables are stored - // in /src/assets/scss/_variables.scss - $footer-bg: #f5f5f5; - - // Local mixins - // - // Which are meant to be used only in this module. »Global« mixins are stored - // in /src/assets/scss/theme/_mixins.scss - - // Styles - // - position: absolute; - bottom: 0; - width: 100%; - - // Set the fixed height of the footer here - height: $footer-height; - background-color: $footer-bg; - - > .container { - padding-right: 15px; - padding-left: 15px; - } - - .footer-text { - margin: $footer-text-margin 0; - } + // Local variables + // + // Which are meant to be used only in this module. »Global« variables are stored + // in /src/assets/scss/_variables.scss + $footer-bg: #f5f5f5; + + // Local mixins + // + // Which are meant to be used only in this module. »Global« mixins are stored + // in /src/assets/scss/theme/_mixins.scss + + // Styles + // + position: absolute; + bottom: 0; + width: 100%; + + // Set the fixed height of the footer here + height: $footer-height; + background-color: $footer-bg; + + > .container { + padding-right: 15px; + padding-left: 15px; + } + + .footer-text { + margin: $footer-text-margin 0; + } } diff --git a/src/assets/scss/theme/_mixins.scss b/src/assets/scss/theme/_mixins.scss index f96695e..feb87e3 100644 --- a/src/assets/scss/theme/_mixins.scss +++ b/src/assets/scss/theme/_mixins.scss @@ -8,9 +8,9 @@ // @mixin opacity($opacity) { - // Opacity for oldIEs - $opacity-ie: ($opacity * 100); + // Opacity for oldIEs + $opacity-ie: ($opacity * 100); - opacity: $opacity; - filter: alpha(opacity=$opacity-ie); + opacity: $opacity; + filter: alpha(opacity=$opacity-ie); } diff --git a/src/assets/scss/theme/_scaffolding.scss b/src/assets/scss/theme/_scaffolding.scss index d6b91fd..1a1301b 100644 --- a/src/assets/scss/theme/_scaffolding.scss +++ b/src/assets/scss/theme/_scaffolding.scss @@ -12,37 +12,37 @@ // See http://getbootstrap.com/getting-started/#support-ie10-width // stylelint-disable at-rule-empty-line-before @-webkit-viewport { - width: device-width; + width: device-width; } @-moz-viewport { - width: device-width; + width: device-width; } @-ms-viewport { - width: device-width; + width: device-width; } @-o-viewport { - width: device-width; + width: device-width; } @viewport { - width: device-width; + width: device-width; } // stylelint-enable html { - // Get properties related to sticky footer. See _footer.scss - @include footer-htmlProps(); + // Get properties related to sticky footer. See _footer.scss + @include footer-htmlProps(); } body { - overflow-y: scroll; - padding-top: 70px; - padding-bottom: 30px; + overflow-y: scroll; + padding-top: 70px; + padding-bottom: 30px; - // Optimize legibility on Retina displays - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; + // Optimize legibility on Retina displays + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; - // Get properties related to sticky footer. See _footer.scss - @include footer-bodyProps(); + // Get properties related to sticky footer. See _footer.scss + @include footer-bodyProps(); } diff --git a/src/assets/scss/theme/_testResponsiveHelpers.scss b/src/assets/scss/theme/_testResponsiveHelpers.scss index 8e591e9..874cca6 100644 --- a/src/assets/scss/theme/_testResponsiveHelpers.scss +++ b/src/assets/scss/theme/_testResponsiveHelpers.scss @@ -7,168 +7,168 @@ body::after, body::before, html::before { - @include opacity(0.8); - - background: grey; - color: white; - content: 'undefined'; - display: inline; - padding: 0.5em 1em; - position: absolute; - text-align: center; - z-index: 9999; - font-size: 14px; - font-family: verdana, sans-serif; + @include opacity(0.8); + + background: grey; + color: white; + content: 'undefined'; + display: inline; + padding: 0.5em 1em; + position: absolute; + text-align: center; + z-index: 9999; + font-size: 14px; + font-family: verdana, sans-serif; } body { - &::after { - @media #{$retina} { - content: 'undefined / retina'; - } - - @media #{$xs-only} { - content: 'xs-only'; - left: 0; - bottom: 0; - - @media #{$retina} { - content: 'xs-only / retina'; - left: 0; - bottom: 0; - } - } - - @media #{$sm-only} { - content: 'sm-only'; - left: 0; - bottom: 0; - - @media #{$retina} { - content: 'sm-only / retina'; - left: 0; - bottom: 0; - } - } - - @media #{$md-only} { - content: 'md-only'; - left: 0; - bottom: 0; - - @media #{$retina} { - content: 'md-only / retina'; - left: 0; - bottom: 0; - } - } - - @media #{$lg-only} { - content: 'lg-only'; - left: 0; - bottom: 0; - - @media #{$retina} { - content: 'lg / retina'; - left: 0; - bottom: 0; - } - } - } - - &::before { - @media #{$retina} { - content: 'undefined / retina'; - } - - @media #{$lg-and-below} { - content: 'lg-and-below'; - left: 0; - top: 0; - - @media #{$retina} { - content: 'lg-and-below / retina'; - left: 0; - top: 0; - } - } - - @media #{$md-and-below} { - content: 'md-and-below'; - left: 0; - top: 0; - - @media #{$retina} { - content: 'md-and-below / retina'; - left: 0; - top: 0; - } - } - - @media #{$sm-and-below} { - content: 'sm-and-below'; - left: 0; - top: 0; - - @media #{$retina} { - content: 'sm-and-below / retina'; - left: 0; - top: 0; - } - } - } + &::after { + @media #{$retina} { + content: 'undefined / retina'; + } + + @media #{$xs-only} { + content: 'xs-only'; + left: 0; + bottom: 0; + + @media #{$retina} { + content: 'xs-only / retina'; + left: 0; + bottom: 0; + } + } + + @media #{$sm-only} { + content: 'sm-only'; + left: 0; + bottom: 0; + + @media #{$retina} { + content: 'sm-only / retina'; + left: 0; + bottom: 0; + } + } + + @media #{$md-only} { + content: 'md-only'; + left: 0; + bottom: 0; + + @media #{$retina} { + content: 'md-only / retina'; + left: 0; + bottom: 0; + } + } + + @media #{$lg-only} { + content: 'lg-only'; + left: 0; + bottom: 0; + + @media #{$retina} { + content: 'lg / retina'; + left: 0; + bottom: 0; + } + } + } + + &::before { + @media #{$retina} { + content: 'undefined / retina'; + } + + @media #{$lg-and-below} { + content: 'lg-and-below'; + left: 0; + top: 0; + + @media #{$retina} { + content: 'lg-and-below / retina'; + left: 0; + top: 0; + } + } + + @media #{$md-and-below} { + content: 'md-and-below'; + left: 0; + top: 0; + + @media #{$retina} { + content: 'md-and-below / retina'; + left: 0; + top: 0; + } + } + + @media #{$sm-and-below} { + content: 'sm-and-below'; + left: 0; + top: 0; + + @media #{$retina} { + content: 'sm-and-below / retina'; + left: 0; + top: 0; + } + } + } } html::before { - @media #{$retina} { - content: 'undefined / retina'; - } - - @media #{$sm-and-above} { - content: 'sm-and-above'; - right: 0; - bottom: 0; - - @media #{$retina} { - content: 'sm-and-above / retina'; - right: 0; - bottom: 0; - } - } - - @media #{$md-and-above} { - content: 'md-and-above'; - right: 0; - bottom: 0; - - @media #{$retina} { - content: 'md-and-above / retina'; - right: 0; - bottom: 0; - } - } - - @media #{$lg-and-above} { - content: 'lg-and-above'; - right: 0; - bottom: 0; - - @media #{$retina} { - content: 'lg-and-above / retina'; - right: 0; - bottom: 0; - } - } - - @media #{$xl-and-above} { - content: 'xl-and-above'; - right: 0; - bottom: 0; - - @media #{$retina} { - content: 'xl-and-above / retina'; - right: 0; - bottom: 0; - } - } + @media #{$retina} { + content: 'undefined / retina'; + } + + @media #{$sm-and-above} { + content: 'sm-and-above'; + right: 0; + bottom: 0; + + @media #{$retina} { + content: 'sm-and-above / retina'; + right: 0; + bottom: 0; + } + } + + @media #{$md-and-above} { + content: 'md-and-above'; + right: 0; + bottom: 0; + + @media #{$retina} { + content: 'md-and-above / retina'; + right: 0; + bottom: 0; + } + } + + @media #{$lg-and-above} { + content: 'lg-and-above'; + right: 0; + bottom: 0; + + @media #{$retina} { + content: 'lg-and-above / retina'; + right: 0; + bottom: 0; + } + } + + @media #{$xl-and-above} { + content: 'xl-and-above'; + right: 0; + bottom: 0; + + @media #{$retina} { + content: 'xl-and-above / retina'; + right: 0; + bottom: 0; + } + } } diff --git a/src/handlebars/helpers/add-year.js b/src/handlebars/helpers/add-year.js index 7361989..8b30db5 100644 --- a/src/handlebars/helpers/add-year.js +++ b/src/handlebars/helpers/add-year.js @@ -12,7 +12,7 @@ * */ function addYear(s) { - return s + ' ' + new Date().getFullYear(); + return s + ' ' + new Date().getFullYear(); } module.exports = addYear;