if you to play with yarn:
yarn
or if your more of an NPM girl...
npm install
- metalsmith-assets to copy webpack files
- metalsmith-markdownit to render markdown
- metalsmith-layouts to apply layouts
webpack-dev-middleware... styles get included via require within page.js
and extracted to a css file with ExtractTextPlugin
Pattern | Description |
---|---|
./content/* |
content files, mainly markdown |
./layouts/*.html |
metalsmith-layouts layout files |
./src/config/paths.js |
path configuration |
./src/assets/css,js |
page javascript and stylesheet files |
./src/scripts/*.js |
build process & dev environment scripts |
./dist/assets/**/* |
webpack output directory |
./dist/site/**/* |
metalsmith output directory |
Just run:
yarn dev
or if you like...
npm run dev
this will spawn http://localhost:3000
with browser-sync!
Browser sync spawns a basic webserver with the webpack-dev-middleware injected.
- browser-sync: Rebuilds metalsmith when content or layouts change.
- webpack-dev-middleware: Triggers browser-sync when webpack files like scripts or styles change
- nodemon: Restarts dev server when build scripts or config changes
- The dev server supports the
rs
command to restart the server manually - The
metalsmith-helpers.js
in the scripts folder exports two metalsmith debugging plugins: AStatisticsPlugin
for a general overview and aDebugPlugin
- The metalsmith-layouts config contains a little helper for handlebars to output variable content. Usage:
<pre>{{debug YOUR_VARIABLE}}</pre>
(Hint: usethis
as variable to debug display the whole file metadata) - Check
npm run
for an overview of all available scripts.
You can run a fresh page build via yarn build
(or npm run build
)
npm-scripts
: SetDEBUG
environment variable tometalsmith*
to enable metalsmith debuggingnpm-scripts
: Clean up./dist/*
directorieswebpack
: Build javascript and stylesheet files via webpackmetalsmith
: Copy webpack assets to site directorymetalsmith
: Fingerprint webpack assetsmetalsmith
: Compile markdown filesmetalsmith
: Apply layoutsmetalsmith
: Show statistics
everything generated in ./dist/site/
With yarn deploy
(or npm run deploy
) you can deploy to GitHub pages via gh-pages
Running yarn server
(or npm run server
) will spawn a production server so you can see how the deploy turned out!
woof!