Test. This is a starter repo for The New Dynamic's web projects. Do with as you wish, but keep in mind that everything here is designed for our internal workflow.
We use a Changelog on all of our projects. Please see that file for updates.
note this quickstart is for established projects; not the starter.
git clone --recurse-submodules https://github.com/theNewDynamic/yourprojectname.git yourprojectname
yarn install
yarn start
yarn deploy
(or hugo --gc
if you're not generating fonts or JS) to generate a minified, purged CSS file.resources
folder into your repository.require
)When possible, we use Kyle Mathews' Typefaces so that we can server our font files locally. Just add the typeface to assets/index.js
and run the webpack build, as above (yarn build
). This will generate the font files into the static/fonts
directory (which Hugo will automatically copy into the public directory) and generate a fonts CSS file, which then Hugo will minify and fingerprint into your head.
We use TailwindCSS and several PostCSS plugins to generate CSS. Most of your CSS will be utility classes in your templates. Hugo will not rebuild your CSS file unless the file itself is changed. In a TailwindCSS context, most of your work occurs in templates, not in the CSS file. To make development easier, we've created a separate PostCSS config file without PurgeCSS. However, this means you must run yarn deploy
(as outline below) for you push your changes.
Download htmltest to your local environment, build your site locall (to the public folder), and run htmltest
in your site's path. If you need to change any parameters of the test, you'll find them in .htmltest.yml
This set up utilizes Parcel for Javascript and open source font processing, Hugo Pipes + PostCSS for CSS processing, and npm-run-all
to run Parcel and Hugo in parallel (see note below). We use the Yarn package manager, but you can use NPM if you like. This configuration is built around the assumption that JS/Fonts are processed in development, not production, though it would take minimal effort to do so.
assets/output/index.js
.fileExists "./assets/output/index.js
Hugo creates a hash of that file from layouts/_head/scripts.html
.public/output/index.min.[hash].js
.assets/css/styles.css
with assets/postcss.config.js
, utilizing Imports, TailwindCSS, Autoprefixer, and PurgeCSS.NODE_ENV=development
is present in the build command, PostCSS will NOT process the file through PurgeCSS.assets/output/index.[hash].css
.assets/output/index.css
and also puts the font files, hashed, in the same directory.fileExists "./assets/output/index.css
Hugo creates the prefetch links from layouts/_head/stylesheets.html
.public/output/index.min.[hash].css
and public/output/font-name.[hash].woff[2]
.content
configuration item. This is done for you, with a glob pattern, but it is something to be aware of.git clone https://github.com/theNewDynamic/hugo-starter.git yourprojectname
cd yourprojectname
rm -rf .git
git init
git add .
git commit -m "initial commit"
git remote add origin https://github.com/theNewDynamic/YOURPROJECTNAME.git
git push -u origin master
git submodule add https://github.com/theNewDynamic/hugo-layout_module-base-2019.git components/layout_module-base
repeat for additional modules
Add theme component to config.toml:
theme = ["layout_module-base", "layout_module-nameofmodule"]
_Note. Hugo uses the "themes" directory by default. We've renamed that to layout_modules
._