This template is build on top of Victor Hugo and Netlify CMS, designed and developed by Darin Dimitroff, spacefarm.digital.
This can be deployed to Netlify and uses Netlify CMS with Netlify Identity and Netlify Forms.
For local development you need npm or yarn and node.js.
Clone this repository, and run yarn
or npm install
from the new folder to install all required dependencies.
Then start the development server with yarn start
or npm start
.
npm run preview
- will start a hugo server and open a web browser
The template is based on small, content-agnostic partials that can be mixed and matched. Refer to the site/layouts/partials
folder for all available partials.
The template uses a custom fork of Tachyons and PostCSS with cssnext and cssnano.
CSS files are located under src/css/*
You can read more about Hugo's template language in their documentation here:
https://gohugo.io/templates/overview/
The most useful page there is the one about the available functions:
https://gohugo.io/templates/functions/
For assets that are completely static and don't need to go through the asset pipeline,
use the site/static
folder. Images, font-files, etc, all go there.
Files in the static folder end up in the web root. So a file called site/static/favicon.ico
will end up being available as /favicon.ico
and so on...
The src/index.js
file is the entrypoint for webpack and will be built to /dist/main.js
You can use ES6 and use both relative imports or import libraries from npm.
Any CSS file imported into the index.js
will be run through Webpack, compiled with PostCSS Next, and
minified to /dist/[name].[hash:5].css
. Import statements will be resolved as part of the build.
To separate the development and production - aka build - stages, all gulp tasks run with a node environment variable named either development
or production
.
You can access the environment variable inside the theme files with getenv "NODE_ENV"
. See the following example for a conditional statement:
{{ if eq (getenv "NODE_ENV") "development" }}You're in development!{{ end }}
All tasks starting with build set the environment variable to production
- the other will set it to development
.