cdowdy / bolt-webpack-theme-starter

Bolt CMS webpack theme starter
1 stars 0 forks source link
bolt-cms bolt-theme

Bolt CMS Webpack Theme Starter

This is a slightly opinionated Bolt CMS starter template using Webpack to build a theme for bolt.

This includes:

It should be used as a "jumping off point".

You'll need to make one adjustment to either you config.yml or your config_local.yml in order for the webpack version assets to be delivered. this is undocumented by Bolt, and they currently have no interest in documenting this or accepting pull requests to document their undocumented use of something for developers. If you follow the docs that bolt links too they use a different config and it wont work. That change is as follows:

assets:
   theme:
        json_manifest_path: "/dist/manifest.json"

This allows your assets to be served from the "dist" directory with the hash that webpack creates.

this in a template:

<link rel="stylesheet" href="https://github.com/cdowdy/bolt-webpack-theme-starter/blob/master/{{ asset('dist/css/app.css', 'theme') }}">

will produce:

<link rel="stylesheet" href="https://github.com/cdowdy/bolt-webpack-theme-starter/blob/master/theme/your_theme/dist/css/app.bbad62558ef19da7e0ca.css">  

the hash part comes from the json manifest produced by webpack.

theme.yml sets the twig template directory to the directory twig.