This repository is meant to work towards the relaunch of the official website of ampproject.org until we reach a progress that makes a merge over to the original repository beneficial.
-
Install the LTS version of NodeJS. An easy way to do so is with
nvm
. (Mac and Linux: here, Windows: here)$ nvm install --lts
-
Install Grow the static site generator used to build amp.dev:
$ curl https://install.grow.io | bash
-
Install the stable version of Yarn. (Mac and Linux: here, Windows: here)
$ curl -o- -L https://yarnpkg.com/install.sh | bash
-
Install the dependencies for the project:
$ cd platform $ npm install
To start developing start a pipeline that takes care of building the frontend, collecting all needed files and start Grow when finished. The pipeline then watches the sources files for changes and rebuilds them if needed.
$ cd platform
$ npm run develop
If you additionally want to import the needed documents and data from GitHub pass in the --import
option to the command and export a valid GitHub access token beforehand like with
$ export AMP_DOC_TOKEN="c59f6..."
$ npm run develop -- --import
If you have checked out a local copy of the amphtml
repository you can also import from there by running the following command. An exported GitHub token is required nevertheless.
$ npm run develop -- --import --local-amphtml-repository='</Users/...>'
Made changes to a lot of Grow documents at once and not quite sure if all references are still valid? You can run npm run lint:grow
to pick up broken ones.
Building the samples creates a lot of individual files per sample. In order to still have a quick startup time for development only changed samples are rebuilt. To freshly build all samples you can run npm run develop -- --clean-samples
.
To run a local test build that does all the minifying and vends the static pages instead of proxying them through to Grow you can run
$ cd platform
$ npm run build:local
$ npm run start:local
To build and deploy to the staging environment on Google App Engine run the following
$ cd platform
$ npm run build:staging
$ npm run deploy:staging
Copyright 2019 The AMP HTML Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.