GithubHelp home page GithubHelp logo

patlolla-sai-charan-reddy / react-amp-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ariel-rodriguez/react-amp-template

0.0 0.0 0.0 2.89 MB

AMP template generator

License: Other

JavaScript 100.00%

react-amp-template's Introduction

react-amp-template

Server side rendering with React + ModularCSS/JSCSS + AMP-custom-elements.
Another fun library to generate AMP documents.

Install

react-amp-template is distributed via npm:

  • yarn add react-amp-template
var React = require('react');
var RAMPT = require('react-amp-template').default;

var rampt = new RAMPT({
  template: {
    head: {
      title: 'react amp template',
      canonical: 'http',
    }
  }
});

var element = React.createElement('div', null, 'Hello World');

// add meta tag single mode.
addMeta({
  type: 'application/ld+json',
  content: "{'@context': 'http://schema.org', '@type': 'NewsArticle'}"
});

// register any amp-script. just an example.
addScript('amp-social-share');

rampt
  .renderStatic(element)
  .then(console.log)
  .catch(function(error){
    console.log('Errors founds! Use npm run debug for debug trace.');
    console.log('Document failed '+((error.validation) ? 'at AMP validations.' : 'at internal rendering.'));
    console.log('Markup output: ', error.markup);
    process.exit(1);
  });

PREVIEW:

react-amp-template demo output


Features

โšก AMP custom elements
Ready to render AMP components see more https://ampbyexample.com/#components
๐Ÿ’… Modular CSS
Style with the power of (Aphrodite)[https://github.com/Khan/aphrodite]
:suspect: Built-in AMP validation
By default, all content generated will be verified through (AMP validator)[https://github.com/ampproject/amphtml/tree/master/validator] to ensure safety.

API

๐Ÿ’ค

๐Ÿง Contributing

  • $git clone [email protected]:Ariel-Rodriguez/react-amp-template.git
  • yarn
  • create an issue, create a branch with issue initials
  • hack and ensure tests pass. Add unit tests if needed.
  • npm run build
  • npm run test
  • add descriptive commit & push

Try bellow examples

  • npm start
  • npm run examples
  • cd examples/simple && yarn && npm start

License

This project is licensed under the Apache License, Version 2.0. Copyright (c) 2016 Ariel Fernando Rodriguez. For more information see LICENSE.md.

react-amp-template's People

Contributors

ariel-rodriguez avatar arieldelfor avatar krlospelaez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.