GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • Creating Targets
  • Static File Drops
  • Command Line Interface

This view

  • Original page
  • New address

GeezerVison is showing makecode.com — pxt-staticpkg Manual Page

Skip to main content
About MakeCode Blog Online Learning Contact Us Tools
Technical Docs
JS Editor Features Programming Language Async Functions Partial Flashing Source Embedding Updating Blockly Version Accessibility Profiling Debugging Hardware
Creating Targets
pxtarget.json Defining Blocks Auto-generation of .d.ts Static File Drops Simulator Theming Editor Embedding resources
Creating Extensions
Getting started pxt.json Extension versioning Extension localization Extension approval Editor extensions GitHub Extension Authoring
Writing Docs
Macros Anchors Tutorials User Tutorials Skillmaps Routing Licensing Testing
Translations
Translation languages Localization files Parts to translate Translating markdown Translator roles In context translation
Blocks Embedding
Command Line Interface
install build bump deploy console gdb staticpkg update pyconv hidserial hiddmesg login
Labs UF2 File Format Accessibility Telemetry

pxt-staticpkg Manual Page

Packages the target into static HTML pages

pxt staticpkg [--route route] [--githubpages] [--output output] [--locs-src locs-src] [--bump] [--nopr]

Description

Compiles the PXT editor into static HTML files that can be served without a server or integrated into an app. The resulting files are placed in built/packaged.

Flags:

route (optional)

Routing path. If missing, defaults to local. The route will be injected into the all the paths in the application.

githubpages (optional)

Generate a web site compatible with GitHub pages.

output (optional)

Directory for generated files.

This directory is cleaned before starting the process.

locs-src (optional)

Directory to fetch editor translations to include in the build.

Files must be listed as follows:

{locs-src}/{lang id}/target-strings.json
{locs-src}/{lang id}/sim-strings.json
{locs-src}/{lang id}/{package id}-strings.json
{locs-src}/{lang id}/{package id}-jsdoc-strings.json

where {locs-src} is the directory parameter passed in here, {lang id} is one of the language identifiers listed as in availableLocales in pxtarget.json, and {package id} is the for packages listed in bundleddirs (e.g. core).

minify (optional)

Minifies all generated js files.

githubpages (optional)

Generate a web site compatible with GitHub pages.

bump (option)

Bump the version number before generating pages. Protected branches or an unknown branch protection status default to a pull request.

nopr (optional)

With --bump, explicitly use a direct push instead of a pull request. This allows SSH-authenticated checkouts without a GitHub credential-helper token to request a direct bump:

pxt staticpkg --bump --nopr

Git's push authorization and branch protection rules still apply. Without --bump, --nopr does not change the version.

Deploying PXT with static files

Running pxt staticpkg will create a number of files under built/packaged. You can use pxt serve -pkg or any other any web server. For example, you can use http-server for easy testing.

npm install -g http-server
http-server -c-1 built/packaged

You can also run pxt staticpkg --route foo, which will create files under built/packaged/foo that assume they sit under /foo/ on the web server. If you do not specify anything, the files assume they sit right under /. To test it, run pxt serve -pkg and head to http://localhost:3232/foo/index.html.

GitHub Pages support

GitHub provides you with free hosting for your project files.

If you wish to publish your web site to GitHub pages, simply add --githubpages to the command.

This will:

  • create a fresh checkout in built/gh-pages if needed
  • implicitly run pxt staticpkg --route repo-name
  • copy files from built/packaged/repo-name to built/gh-pages
  • add files to git, commit, and push

You can then head to https://your-username.github.io/repo-name/.

Edit this page on GitHub
Edit template of this page on GitHub

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.