# Prettier Website
https://prettier.io/
## Setup
1. Build the Prettier browser libs for the playground by running the following in the project root dir:
```sh
cd your/path/to/prettier
yarn build-docs
```
(To build for master, use `PULL_REQUEST=true yarn build-docs`)
2. Switch to the `website` dir and start the server:
```sh
cd website
yarn start
```
## Configuration
In the project repo, the `docs` folder is used to hold documentation written in markdown. A `blog` folder can be used to hold blog posts written in markdown.
### Document and Blog Front Matters
Documentation should contain front matter that follows this example:
```yaml
id: doc1 # used for docs to find each other and to map links
title: Document Title
layout: docs1 # used to determine different sidebar groupings
category: Sidebar Category 1 # Category on the sidebar under which this doc goes
permalink: docs/en/doc1.html # link to the document that is used for site
previous: doc0 # previous doc on sidebar for navigation
next: doc2 # next doc on the sidebar for navigation
# don't include next if this is the last doc; don't include previous if first doc
---
```
Blog posts should be written as markdown files with the following front matter:
```yaml
title: Blog Post Title
author: Author Name
authorURL: http://twitter.com/author # (or some other link)
authorFBID: 21315325 # id to get author's picture
---
```
In the blog post you should include a line `<!--truncate-->`. This will determine under which point text will be ignored when generating the preview of your blog post. Blog posts should have the file name format: `yyyy-mm-dd-your-file-name.md`.
### Language Configurations
The `examples` script will generate a `languages.js` file and `i18n` folder for translation support, but if you only wish to support English, then these are not needed.
### Site Configurations
Configure the siteConfig.js file which has comments guiding you through what needs to be done and how each configuration affects your website.
Customize core/Footer.js which will serve as the footer for each page on your website.
Include your own top-level pages as React components in `pages/`. These components should just be the body sections of the pages you want, and they will be included with the header and footer that the rest of Docusaurus uses. Examples are provided for your reference. Currently, if you want to add other React components to your pages, you must include all of it inside that file due to how `require` paths are set-up. You may also include `.html` files directly, but this is not recommended, and these will just be served as is and will not have any of the header/footer/styles shared by the rest of Docusaurus.
All images and other static assets you wish to include should be placed inside the `static` folder. Any `.css` files provided in `static` will be concatenated to the standard styles provided by Docusaurus and used site-wide.
Files placed in `static/` will be accessible in the following way: `static/img/image.png` will be accessible at `img/image.png`.
Please run <code>yarn svgo _path/to/image.svg_</code> before committing a new SVG to the repository.
## Using Docusaurus
### Run the Server
To run your website locally run the script:
```bash
yarn start
```
This will start a server hosting your website locally at `localhost:3000`. This server will ignore any occurrences `siteConfig.baseUrl` in URLs, e.g. `localhost:3000/your-site/index.html` will be the same as `localhost:3000/index.html`. Any changes to configured files will be reflected by refreshing the page, i.e. the server does not need to be restarted to show changes.
### Build Static Pages
To create a static build of your website, run the script:
```bash
yarn build
```
This will generate `.html` files from all of your docs and other pages included in `pages/`. This allows you to check whether or not all your files are being generated correctly. The build folder is inside Docusaurus's directory inside `node_modules`.
### Publishing Your Website
Use CircleCI to publish your website whenever your project repo is updated. Configure your circle.yml file in your project repo to run commands to publish to GitHub Pages. An example is shown here:
```yaml
machine:
node:
version: 6.10.3
npm:
version: 3.10.10
test:
override:
- "true"
deployment:
website:
branch: master
commands:
- git config --global user.email "[email protected]"
- git config --global user.name "Website Deployment Script"
- echo "machine github.com login test-site-bot password $GITHUB_TOKEN" > ~/.netrc
- cd website && npm install && GIT_USER=test-site-bot npm run publish-gh-pages
```
Note that in this case a GitHub user `test-site-bot` is created to use just for publishing. Make sure to give your Git user push permissions for your project and to set a GITHUB_TOKEN environment variable in Circle if you choose to publish this way.
If you wish to manually publish your website with the `publish-gh-pages` script, run the following example command with the appropriate variables for your project:
```
DEPLOY_USER=deltice GIT_USER=test-site-bot CIRCLE_PROJECT_USERNAME=deltice CIRCLE_PROJECT_REPONAME=test-site CIRCLE_BRANCH=master npm run publish-gh-pages
```
没有合适的资源?快使用搜索试试~ 我知道了~
prettier, 漂亮的是一个固执的代码格式化程序.zip
共5845个文件
js:2860个
snap:930个
md:823个
需积分: 10 0 下载量 149 浏览量
2019-10-09
20:33:39
上传
评论
收藏 4.52MB ZIP 举报
温馨提示
prettier, 漂亮的是一个固执的代码格式化程序 的代码格式化程序JavaScript Flow Flow TypeScript TypeScript CSS SCSS · LESS 。JSON 。JSON 。JSON 。Markdown 。你喜欢的语言。?
资源推荐
资源详情
资源评论
收起资源包目录
prettier, 漂亮的是一个固执的代码格式化程序.zip (5845个子文件)
_redirects 298B
configPrecedence 43B
parens.css 9KB
overrides.css 9KB
supports.css 5KB
at-rules.css 5KB
selectors.css 5KB
playground.css 4KB
color-adjuster.css 4KB
selectors.css 4KB
if-else.css 3KB
grid.css 3KB
postcss-nesting.css 3KB
each.css 2KB
media.css 2KB
quotes.css 2KB
include.css 2KB
at-root.css 2KB
import.css 2KB
declaration.css 2KB
for.css 2KB
return.css 2KB
spaces.css 2KB
extend.css 2KB
mixin.css 2KB
custom-selector.css 1KB
while.css 1KB
keyframes.css 1KB
lowercase.css 1KB
namespaces.css 1KB
types.css 1KB
custom-media.css 1KB
font-face.css 1KB
numbers.css 1KB
function.css 1KB
case.css 1KB
character_escaping.css 958B
cssnext-example.css 954B
inline_url.css 810B
list.css 790B
nested-indention.css 700B
at-media.css 679B
modules.css 652B
counter-style.css 534B
postcss-mixins.css 473B
at-rules.css 450B
font-feature-values.css 447B
page.css 401B
nested-indention-2.css 396B
readme.css 393B
viewport.css 335B
charset.css 324B
debug.css 322B
font-face.css 301B
indent.css 294B
values.css 282B
postcss-simple-vars.css 275B
quotes.css 267B
CRLF.css 265B
comment.css 255B
selector_list.css 246B
bug.css 245B
map.css 233B
nested-mixin-2.css 227B
nested-2.css 227B
media-queries-ranges.css 225B
postcss-nested.css 225B
variables.css 214B
functional-syntax.css 211B
custom-selector.css 210B
non-nested-combinator.css 207B
nested-mixin.css 194B
custom-selectors.css 191B
selectors.css 189B
nested.css 188B
whitespace-syntax.css 185B
fill.css 177B
postcss-nested-props.css 166B
hexcolor.css 163B
block.css 160B
font-shorthand.css 147B
comment-in-rules.css 139B
long_rule.css 135B
combinator.css 135B
ie-hacks.css 129B
insensitive.css 125B
prettier-ignore.css 120B
composes.css 119B
custom-media-queries.css 119B
import.css 115B
params.css 97B
nested-atrule.css 96B
media-indent-with-import.css 91B
with-pragma-in-multiline.css 89B
empty.css 89B
namespaces.css 88B
with_comments.css 88B
var-notation.css 87B
media-indent.css 87B
dirty.css 86B
共 5845 条
- 1
- 2
- 3
- 4
- 5
- 6
- 59
资源评论
weixin_38743968
- 粉丝: 404
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功