← Back to google/styleguide

How to Deploy & Use google/styleguide

Google Style Guides Deployment and Usage Guide

Prerequisites

This project is a collection of style guides for various programming languages and does not require any runtime installation. However, to effectively use these style guides, you should have:

  • A web browser to view the HTML guides
  • Text editor or IDE for your preferred programming language
  • Version control system (Git) for accessing the repository

Installation

  1. Clone the repository:

    git clone https://github.com/google/styleguide.git
    cd styleguide
    
  2. No additional installation required - the style guides are static HTML files that can be viewed directly in a browser.

Configuration

No configuration is required to use the style guides. The guides are ready to use as-is.

Build & Run

Viewing the Style Guides

  1. Local Development:

    • Open any of the HTML files in your web browser:
      # For C++ style guide
      open cppguide.html
      # For Python style guide
      open pyguide.html
      # For JavaScript style guide
      open jsguide.html
      
  2. Production Use:

    • The style guides can be hosted on any static web server
    • Simply copy the HTML files to your web server's document root

Available Style Guides

The repository contains style guides for the following languages:

  • C++: cppguide.html
  • C#: csharp-style.html
  • Swift: swift/
  • Objective-C: objcguide.md
  • Go: go/
  • Java: javaguide.html
  • JSON: jsoncstyleguide.xml
  • Python: pyguide.html
  • R: Rguide.html
  • Shell: shellguide.html
  • HTML/CSS: htmlcssguide.html
  • JavaScript: jsguide.html
  • Markdown: docguide/style.html
  • TypeScript: tsguide.html
  • AngularJS: angularjs-google-style.html
  • Common Lisp: lispguide.xml
  • Vim script: vimscriptguide.xml
  • XML: xmlstyle.html

Deployment

Since this is a static documentation project, deployment is straightforward:

  1. GitHub Pages:

    • Enable GitHub Pages in your repository settings
    • The style guides will be automatically deployed to https://<username>.github.io/styleguide/
  2. Static Web Hosting:

    • Upload the entire repository to any static web hosting service
    • Compatible with services like Netlify, Vercel, AWS S3, or any web server
  3. Local Development Server:

    • Use Python's built-in HTTP server:
      python -m http.server 8000
      
    • Access at http://localhost:8000

Troubleshooting

Common Issues

  1. HTML Files Not Rendering Properly

    • Ensure you're opening the HTML files directly in a browser, not viewing the raw source
    • Some guides may reference external resources (CSS, JavaScript) that require internet access
  2. Missing Style Guides

    • Verify you have the latest version of the repository
    • Some guides are in subdirectories (e.g., Swift is in the swift/ directory)
  3. External Links Not Working

    • The style guides contain links to external resources
    • Ensure you have internet connectivity when viewing the guides

Additional Notes

  • No External Contributions: The repository explicitly states that external contributions are not accepted. Changes are made internally at Google first.
  • License: The style guides are licensed under CC-By 3.0, allowing sharing and adaptation with attribution.
  • Git Commit Messages: The README references best practices for writing commit messages, which is relevant if you're using these style guides in your own projects.

Getting Help

  • For issues with the style guides themselves, file an issue using the GitHub tracker: https://github.com/google/styleguide/issues
  • For questions about implementing the style guidelines in your projects, consult the relevant language community or documentation.