Skip to content

Commit

Permalink
Various boilerplate generator fixes
Browse files Browse the repository at this point in the history
* remove ampbyexample references
* fix canonical
* don't generate second amp page
* fix amp-list not being displayed (workaround for
ampproject/amphtml#22552).
  • Loading branch information
sebastianbenz committed May 29, 2019
1 parent 65a6528 commit 7c851ef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 0 additions & 2 deletions boilerplate/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const io = require('./lib/io');
const templates = require('./lib/templates');

const DIST_DIR = 'dist';
const AMP_PATH = 'amp';
const INPUT_FILE = 'templates/index.html';

const generatorTemplate = io.readFile(INPUT_FILE);
Expand Down Expand Up @@ -57,7 +56,6 @@ function initConfig() {
async function generateOptimizedAmpFiles(output) {
const optimized = await optimizeAmp(output);
io.writeFile(DIST_DIR, 'index.html', optimized);
io.writeFile(DIST_DIR, AMP_PATH, 'index.html', output);
}

async function optimizeAmp(html) {
Expand Down
2 changes: 1 addition & 1 deletion boilerplate/lib/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Handlebars.registerHelper('scss', (scssPath) => {
file: templatePath,
includePaths: INCLUDE_PATHS,
});
return new Handlebars.SafeString(result.css.toString());
return new Handlebars.SafeString(result.css.toString().replace('@charset "UTF-8";', ''));
}
}
throw new Error('File not found ' + scssPath);
Expand Down
19 changes: 10 additions & 9 deletions boilerplate/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<link rel="manifest" href="/manifest.json">
<link rel="shortcut icon" href="/static/img/favicon.png">
<link rel="canonical" href="https://ampbyexample.com/boilerplate/">
<link rel="canonical" href="https://amp.dev/boilerplate/">
<title>AMP Boilerplate Generator</title>
<link rel="apple-touch-icon" sizes="57x57" href="/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/favicons/apple-touch-icon-60x60.png">
Expand All @@ -39,11 +39,11 @@
<link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon-180x180.png">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="AMP by Example">
<meta name="apple-mobile-web-app-title" content="AMP Boilerplate Generator">
<link rel="icon" type="image/png" sizes="228x228" href="/favicons/coast-228x228.png">
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#ffffff">
<meta name="application-name" content="AMP by Example">
<meta name="application-name" content="AMP Boilerplate Generator">
<link rel="yandex-tableau-widget" href="/favicons/yandex-browser-manifest.json">
<link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png">
Expand Down Expand Up @@ -188,7 +188,7 @@ <h4>{{label}} {{#help}}<span on="tap:{{id}}-help.toggleVisibility" tabindex="0"
{{#options}}
<div class="option">
{{#checkbox}}
<input id="{{id}}" type="checkbox" on="change:{{id}}-values.toggleVisibility,codeSnippet.changeToLayoutContainer,AMP.setState({
<input id="{{id}}" type="checkbox" on="change:{{id}}-values.toggleVisibility,AMP.setState({
config: {
{{id}}: {
selected: event.checked
Expand All @@ -201,7 +201,7 @@ <h4>{{label}} {{#help}}<span on="tap:{{id}}-help.toggleVisibility" tabindex="0"
})">
{{/checkbox}}
{{#radio}}
<input id="{{id}}" type="radio" name="{{categoryId}}" on="change:{{id}}-values.toggleVisibility,codeSnippet.changeToLayoutContainer,AMP.setState({
<input id="{{id}}" type="radio" name="{{categoryId}}" on="change:{{id}}-values.toggleVisibility,AMP.setState({
config: {
{{#options}}
{{id}}: {
Expand All @@ -228,7 +228,7 @@ <h4>{{label}} {{#help}}<span on="tap:{{id}}-help.toggleVisibility" tabindex="0"
<div class="value">
<label for="{{key}}">{{{label}}}</label>
{{#valueCheckbox}}
<input id="{{key}}" value="{{value}}" type="checkbox" on="input-debounced:codeSnippet.changeToLayoutContainer,AMP.setState({
<input id="{{key}}" value="{{value}}" type="checkbox" on="input-debounced:AMP.setState({
config: {
{{id}}: {
{{key}}: event.checked
Expand All @@ -237,7 +237,7 @@ <h4>{{label}} {{#help}}<span on="tap:{{id}}-help.toggleVisibility" tabindex="0"
})">
{{/valueCheckbox}}
{{^valueCheckbox}}
<input id="{{key}}" value="{{value}}" type="text" on="input-debounced:codeSnippet.changeToLayoutContainer,AMP.setState({
<input id="{{key}}" value="{{value}}" type="text" on="input-debounced:AMP.setState({
config: {
{{id}}: {
{{key}}: event.value
Expand All @@ -263,11 +263,12 @@ <h3>Boilerplate</h3>
<div class="ap-m-code-snippet"><pre [hidden]="config.changed"><code>{{{initialCode}}}</code></pre></div>
<amp-list id="codeSnippet"
width="auto"
height="3240"
[height]="1"
layout="fixed-height"
[src]="config"
single-item
items="config"
binding="always"
[is-layout-container]="config.changed"
hidden [hidden]="!config.changed">
<template type="amp-mustache">
{{#formats}}
Expand Down
1 change: 1 addition & 0 deletions boilerplate/templates/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ section {
}
input[type=text] {
padding: 0 8px;
border: none;
}
input[type=checkbox] {
margin-right: auto;
Expand Down

0 comments on commit 7c851ef

Please sign in to comment.