Webpack 3.9.0: 5.3287 minutes
Webpack 4.0.0: 3.86826667 minutes
class TemplateComponent extends HTMLElement { | |
/*...*/ | |
async getTemplate (data) { | |
const templator = (t, d) => new Function('return `' + t + '`').call(d); | |
async function loadTemplate () { | |
return new Promise(resolve => { | |
document.currentScript.ownerDocument.addEventListener('DOMContentLoaded', event => { | |
resolve(event.target.querySelector('template')); | |
}, false); |
<link rel="import" href="template-component.html"> | |
<script> | |
class SsrData extends TemplateComponent { | |
constructor () { | |
super(SsrData.is); | |
} | |
static get is () { | |
return 'ssr-data'; | |
} |
<script> | |
/** | |
* Component that automagically finds sibling <template> | |
* to the instance script and uses it for rendering, with | |
* out without the getState form the instace of the child. | |
* | |
* @class TemplateComponent | |
* @extends {HTMLElement} | |
*/ | |
class TemplateComponent extends HTMLElement { |
'use latest'; | |
import express from 'express'; | |
import compression from 'compression'; | |
const app = express(); | |
if (process.env.NODE_ENV === 'production') { | |
app.use(compression()); | |
} |
export default function durationToMinutes (durationString) { | |
return durationString | |
.match(/\d+\w/g) | |
.map(u => ([parseInt(u.match(/\d+/g), 10), u.split(/\d+/g)[1]])) | |
.map(a => { | |
switch (a[1]) { | |
case 'D': return a[0] * 1440; | |
case 'H': return a[0] * 60; | |
case 'M': return a[0]; | |
case 'S': return a[0] / 60; |
'use latest'; | |
import express from 'express'; | |
import request from 'request'; | |
import { fromExpress } from 'webtask-tools'; | |
import bodyParser from 'body-parser'; | |
const app = express(); | |
app.use(bodyParser.json()); |
class TemplateStore { | |
constructor (node) { | |
if (!(node instanceof HTMLElement)) { | |
throw new Error('DOM Node for template storage is not set up. Please pass in an HTMLElement to the constructor.'); | |
} | |
this.parentDOMNode = node; | |
} | |
/** |
npm install --save-dev gist:8ce270954c48a4092b5dc62a0866792e
/** | |
* Converts a snake-case string to camelCase | |
* | |
* @param {string} str kebab-cased string | |
* @returns {string} camelCased string | |
*/ | |
export function kebabToCamelCase(str) { | |
return str.replace(/(-)([a-z])/g, g => g[1].toUpperCase()); | |
} |