Điểm qua ampproject/amp-by-example: 751 sao trên GitHub, viết chủ yếu bằng HTML. DEPRECATED: AMP by Example has been merged into amp.dev
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Every HTML comment creates a separate example section spanning the following HTML element.
<!-- This comment spans the whole following section including the two images -->
<section>
<amp-img src="img/image1.jpg" width="200" height="100" layout="responsive"></amp-img>
<amp-img src="img/image2.jpg" width="200" height="100" layout="responsive"></amp-img>
</section>
Nesting comments are not supported:
<!-- A comment -->
<div>
<!-- This does not work because the parent div has already a comment -->
<amp-img src="img/image1.jpg" width="200" height="100" layout="responsive"></amp-img>
</div>
<div>
<!-- Commenting inside nested tags works though -->
<amp-img src="img/image1.jpg" width="200" height="100" layout="responsive"></amp-img>
</div>
If your comment spans multiple elements, wrap these in an single div without any attributes. The enclosing div tag will be hidden in source code listings:
<!-- The enclosing `div` will be hidden in source code listings. -->
<div>
<button on="tap:my-lightbox" role="button" tabindex="0">Open lightbox</button>
<amp-lightbox id="my-lightbox" layout="nodisplay">
<h1>Hello World!</h1>
</amp-lightbox>
</div>
Sample Styling
Sometimes it's good to add a little bit more styling to a sample (e.g. to separate a button from an input field). To make sure that all samples have a consistent styling, please use the following CSS variables to style specific elements in your sample:
Only add the ones that you need to the sample. These CSS variable declarations will be added automatically to your sample, if you use gulp create ... to create the sample.
Colors
Spaces
Formatting
You can use markdown to format your documentation:
<!--
A simple [responsive](https://www.ampproject.org/docs/guides/responsive/control_layout.html)
image - *width* and *height* are used to determine the aspect ratio.
-->
<amp-img src="img/image1.jpg" width="200" height="100" layout="responsive"></amp-img>
[tip type="important"]
Warning! This might go wrong.
[/tip]
Hints
If you'd like to add additional information about a single element inside a section, use the <!--~ hint syntax ~-->:
<!-- A comment about the form. -->
<form method="post"
action-xhr="https://example.com/subscribe"
target="_top">
<fieldset>
<input type="text" name="username">
<!--~ Addition explanation about the hidden field. ~-->
<input type="hidden" name="id" value="abc">
</fieldset>
</form>
This will make the <input> element clickable, with the additional explanation appearing on click.
Drafts
You can mark samples as drafts if they are still work-in-progress. This means the samples won't show up in the start page.
<!---
draft: true
--->
Experimental Features
If your sample is using one or more experimental features, you can add a metadata section (<!--- ... --->) with the variable experiments to specify which experiments to enable. This will skip its validation and add an experimental note with instructions to your sample:
Visually rich examples can provide a preview mode like this. Enable via metadata in the sample:
<!---
preview: default
--->
There is a special preview mode for AMP Ad samples:
<!---
preview: a4a
--->
Single Column Layout
If your sample looks better with a single column layout, you can disable the code and preview columns adding the following flags to your sample file:
<!---
hideCode: true
hidePreview: true
--->
Disabling the Playground
If it doesn't make sense for your sample to provide a playground link, you can disable it:
<!---
disablePlayground: true
--->
Running the backend server
If you need to run or write a sample that depends on the backend server, you can run a local version.
Install the Google App Engine SDK for Go.
Run the backend server in watch mode so it will recompile on change.
$ gulp backend:watch
If you get an error message can't find import: "golang.org/x/net/context", you have to manually install and configure the GO appengine environment:
# install the google.goland.org/appengine package
$ go get google.golang.org/appengine
# explicitly set the GOROOT and APPENGINE_DEV_APPSERVER env vars
$ export GOROOT=$HOME/local/google-cloud-sdk/platform/google_appengine/goroot
$ export APPENGINE_DEV_APPSERVER=$(which dev_appserver.py)
If everything went well, the full site should now be running on http://localhost:8080/
Adding backend functionality
Sample specific backend endpoints should be defined in their own file, e.g. for a sample amp-my-component.html the backend should be backends/amp-my-component.go.
How to style examples
You can’t reference external stylesheets when creating samples. AMP by Example provides a default styling for common elements (p, h1, h2, h3, a, ...) which you should use. Sample specific styles must live in the head of the document using the tag <style amp-custom>. Try to keep the additional CSS for samples to a minimum and use the default styles as often as possible. If you compile a sample via Gulp and run it, the default styling will be applied.
Please note: if you copy code from a sample's code section, you will not get the style that you can see in the preview section.
Contributing
Please see the CONTRIBUTING file for information on contributing to amp-by-example.
License
AMP by Example is made by the AMP Project, and is licensed under the Apache License, Version 2.0.
ampproject/amp-by-example có 751 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/ampproject/amp-by-example. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
ampproject/amp-by-example có phải mã nguồn mở không?
Có — ampproject/amp-by-example phát hành theo license Apache-2.0, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/ampproject/amp-by-example.
ampproject/amp-by-example còn đang phát triển không?
Commit gần nhất trên ampproject/amp-by-example là 6.9 năm trước (theo timestamp GitHub). Repo có 485 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
ampproject/amp-by-example dùng license gì?
ampproject/amp-by-example phát hành theo license Apache-2.0. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
ampproject/amp-by-example là gì?
ampproject/amp-by-example (ampproject/amp-by-example) là dự án HTML trên GitHub. Theo mô tả gốc: DEPRECATED: AMP by Example has been merged into amp.dev
ampproject/amp-by-example viết bằng ngôn ngữ gì?
ampproject/amp-by-example chủ yếu viết bằng HTML. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc thêm về ampproject/amp-by-example ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/ampproject/amp-by-example là nguồn chính thức.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về amp-by-example?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về amp-by-example.