Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Compile, post compilation transform and publish

Rex edited this page Nov 14, 2016 · 6 revisions

Prepare Environment

Install NodeJS, both version 5.x or 6.x are suitable. However with version 6.x, there will be some extra warning messages, ignore them.

Install “gulp” and “harp” globally: “npm install -g gulp harp”

Clone “angular/angular” to an adjacent folder next to your angular.io translation working directory. Make sure that you have two folders next to each other on the same level.

Keep the “angular/angular” in sync, they will be required to generate API documents and Angular Cheat Sheet.

Translate and preview

In terminal or console, go to your working directory and install all dependencies: “npm install” Run “gulp serve-and-sync-devguide” to compile and preview. Your default browser will be opened to “localhost:3000”. When you make changes, browser will be refreshed automatically.

Post compilation transform

We have a js file called “translate.js” under “public/translate/cn” folder, it is used to hide the original text and allow readers to toggle them at will in browsers.

It relies on one convention: original text is always on the odd node and translation is always on the even node. The script adds relevant css classes to each nodes.

Please note that isPureEnglish method is for Chinese language only. It may not apply to other languages. Please feel free to alter the script file to meet your own requirements. If you encounter any problems, we are happy to help.

##Compile and publish

If you compile locally, run “npm check-deploy” command, it will compile the whole website into the “www” folder and listen to port 8080 in a browser.

If you need to deploy on a CI server, use the following commands:

rm -fr public/docs
git reset --hard
npm i
gulp build-docs && gulp _harp-compile

##Deploy

www folder contains a complete static website. You can deploy it to any web server.