How to run angularjs material documentation locall

2019-08-17 05:05发布

问题:

I have compiled the newest angularjs material and find out that links in the doc all point to absolute URL material.angularjs.org/.... I want to be able to read the doc and demo content locally.

回答1:

Follow these steps (for Windows users):

  • Install git, Node v6.10.3

    Git https://git-for-windows.github.io/

    Node v6.10.3 https://nodejs.org/en/blog/release/v6.10.3/

  • Install dependencies npm,glub and http-server(use cmd or PowerShell)

    npm Insatall npm install npm@3.10.10

    gulp Insatall npm install --global gulp-cli

    http-server Insatall npm install http-server -g

  • Clone the angular-material repository:

    git clone https://github.com/angular/material.git

  • Build the repository:

    cd material
    npm install

  • Build the docs:

    gulp build; gulp docs; gulp watch --dev

  • run the docs:

    cd dist/docs; http-server

Then simply go to http://192.168.42.130:8080 or http://127.0.0.1:8080

*Special thanks for Prerak Sola



回答2:

You can clone the repo : https://github.com/angular/material

and then launch with your webserver the docs dir that has all resources generated for the documentation.

There is even a README in the doc dir : https://github.com/angular/material/blob/master/docs/README.md



回答3:

You can generate the offline documentation by following the below steps:

  • Install git, nodejs and npm
  • Install gulp:
    npm install --global gulp-cli

  • Clone the angular-material repository:
    git clone https://github.com/angular/material.git

  • Build the repository:
    cd material
    npm install

  • Build the docs:
    gulp watch site --dev

Currently the documentation building task is failing. I have submitted a issue here. Follow this to see what workaround or update they provide.

Update:
As per the response here, you'll need to install node v6.10.3 and npm 3.10.10 for building the docs locally. Install these specific versions and follow the above steps.