ariel-rodriguez / react-amp-template Goto Github PK
View Code? Open in Web Editor NEWAMP template generator
License: Other
AMP template generator
License: Other
This has happened to me after I rewrote the example app to allow generation of multiple files.
Basically what happened is that Head component when feeded with data (json prop in example) was appending each new data instead of overwriting props like the component Body does.
Basically this line 11. {state.elements} in https://github.com/Ariel-Rodriguez/react-amp-template/blob/master/src/Components/Head.jsx might be the source
Thanks for the project!
I get an error if I want to start the example:
npm start
> [email protected] start C:\xampp\htdocs\react-amp-template\examples\simple-server
> npm run build && npm run serve
> [email protected] build C:\xampp\htdocs\react-amp-template\examples\simple-server
> babel src -d dist -s && cd server && node render.js
src\App.jsx -> dist\App.js
src\Components\Body.jsx -> dist\Components\Body.js
src\Components\Head.jsx -> dist\Components\Head.js
src\Components\Heading.jsx -> dist\Components\Heading.js
src\Components\PostCard.jsx -> dist\Components\PostCard.js
src\Components\SocialShare.jsx -> dist\Components\SocialShare.js
src\globalStyles.js -> dist\globalStyles.js
C:\xampp\htdocs\react-amp-template\examples\simple-server\server\render.js:16
throw Error(err)
^
Error: Error: ENOENT: no such file or directory, open 'C:\xampp\htdocs\react-amp-template\examples\simple-server\server\public\index.html'
at fs.writeFile.err (C:\xampp\htdocs\react-amp-template\examples\simple-server\server\render.js:16:11)
at fs.js:1279:7
at FSReqWrap.oncomplete (fs.js:135:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `babel src -d dist -s && cd server && node render.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\B\AppData\Roaming\npm-cache\_logs\2018-05-08T11_31_03_772Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `npm run build && npm run serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\B\AppData\Roaming\npm-cache\_logs\2018-05-08T11_31_03_809Z-debug.log
C:\xampp\htdocs\react-amp-template\examples\simple-server>
Npm log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\b\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Users\b\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\xampp\htdocs\react-amp-template\examples\simple-server\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Ruby24-x64\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;c:\app\oracle\product\11.2.0\client_1\bin;C:\WINDOWS\system32\oracle;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Windows\SysWOW64;C:\Program Files (x86)\IBM\Client Access\Emulator;C:\Program Files (x86)\IBM\Client Access\Shared;C:\Program Files (x86)\IBM\Client Access\;C:\WINDOWS\idmu\common;C:\WINDOWS\System32\Windows System Resource Manager\bin;C:\Program Files (x86)\GnuWin32\bin;C:\WINDOWS\syswow64;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\7-Zip;C:\Program Files (x86)\Windows Live\Shared;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Git\cmd;C:\Ruby21-x64\Bin\;C:\Ruby21\Bin\;C:\Program Files (x86)\Yarn\bin;C:\Program Files (x86)\Skype\Phone\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\CenterTools\DriveLock\;C:\Program Files\nodejs\;C:\Users\b\AppData\Roaming\Composer\vendor\bin;C:\Users\b\AppData\Local\Yarn\bin;C:\Users\b\AppData\Local\Microsoft\WindowsApps;C:\Users\b\AppData\Roaming\npm
9 verbose lifecycle [email protected]~start: CWD: C:\xampp\htdocs\react-amp-template\examples\simple-server
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'npm run build && npm run serve' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `npm run build && npm run serve`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\b\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:283:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\b\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\xampp\htdocs\react-amp-template\examples\simple-server
16 verbose Windows_NT 10.0.15063
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\b\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v8.11.1
19 verbose npm v6.0.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `npm run build && npm run serve`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Hello!
I started editing the simple-server example to use amp-list and I got some issues.
This is my actual code:
import React, {Fragment} from 'react'
import styled from 'styled-components'
import { AMP } from 'react-amp-template'
const { List } = AMP
const NewsList = () => (
<Fragment>
<AMP.Script
async
custom-template="amp-mustache"
src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js"
/>
<AMP.Script
async
custom-element="amp-list"
src="https://cdn.ampproject.org/v0/amp-list-0.1.js"/>
<List
id='amp-list'
width='auto'
height='600'
layout='fixed-height'
src='https://ampbyexample.com/json/examples.json'>
<template type="amp-mustache"
id="amp-template-id">
<div>
<a href="{{url}}">{{title}}</a>
</div>
</template>
</List>
</Fragment>
)
I copied it from ampbyexample to start with but when I try to start the server I get the following error:
react-amp-template\examples\simple-server\dist\Components\NewsList.js:58
{ title }
^
ReferenceError: title is not defined
.
Any advice to make it work? url and title are brought by List amp component.
Thank you!
I want to use amp-mustache, but how can I use this mustache brackets in the rendered version?
My Component:
const Link = () => (<a href={{href}} >Some text</a>);
This should appear in the final rendered HTML file:
<a href={{href}}>Some text</a>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.