Skip to content
Pages
Visit Pages on GitHub
Set theme to dark (⇧+D)

Build configuration

Build commands and directories

You should provide a build command to tell Cloudflare Pages how to build your application. For projects not listed here, consider reading the tool's documentation or framework, and submit a pull request to add it here!

Build directories indicates where your project's build command outputs the built version of your Cloudflare Pages site. Often, this defaults to the industry-standard public, but you may find that you need to customize it.

Below are some standard build commands and directories for popular frameworks and tools.

Framework/toolBuild commandBuild directory
Angular (Angular CLI)ng builddist
Brunchbrunch build --productionpublic
Docusaurusnpm run buildbuild
Eleventyeleventy_site
Ember.jsember builddist
Gatsbygatsby buildpublic
GitBookgitbook build_book
Gridsomegridsome builddist
Hugohugopublic
Jekylljekyll build_site
Mkdocsmkdocs buildsite
Next.js (Static HTML Export)next build && next exportout
Nuxt.jsnuxt generatedist
Pelicanpelican $content [-s settings.py]output
React (create-react-app)npm run buildbuild
React Staticreact-static builddist
Slate./deploy.shbuild
Sveltenpm run buildpublic
Umiumi builddist
Vuenpm run buildpublic
VuePressvuepress build $directory$directory/.vuepress/dist

Environment variables

If your project make use of environment variables to build your site, you can provide custom environment variables via the Pages UI.

Language support and tools

Cloudflare Pages' build environment has broad support for a variety of languages, such as Ruby, Node.js, Python, PHP, and Go (and many more):

FrameworkDefault version
Elixir1.7
Emacs25
Erlang21
Go1.12
Java8
Node.js10
PHP5.6
Python2.7
Ruby2.6.2

Many common tools have been pre-installed as well:

ToolsNotes
Boot
Cask
Composer
DoxygenVersion 1.8.6
Gutenberg
HugoVersion 0.54
GNU MakeVersion 3.8.1
ImageMagickVersion 6.7.7
jqVersion 1.5
Leiningen
OptiPNGVersion 0.6.4
NPMCorresponds with NPM version
pipCorresponds with Python version
PipenvLatest version
YarnVersion 1.13.0
Zola

If you need to use a specific version of a language, e.g. Node.js or Ruby, you can specify it by providing an associated environment variable in your build configuration, or setting the relevant file in your source code. Below are some examples:

Language/toolEnvironment variableFile
GoGO_VERSION
Node.jsNODE_VERSION.nvmrc, .node-version
NPMNPM_VERSION
PythonPYTHON_VERSIONruntime.txt, Pipfile
RubyRUBY_VERSION.ruby-version
YarnYARN_VERSION

If you're looking to set a specific version of a framework your Cloudflare Pages project is using, note that Pages will respect your package manager of choice during your build process. For instance, if you use Gatsby.js, your package.json should indicate a version of the gatsby NPM package, which will be installed using npm install as your project builds on Cloudflare Pages.