To start the development server just run npm start
Folder structure
.
├── 404.html
├── about.md
├── blog.md
├── config <--- This folder contains the different Webpack config files
│ ├── manifest.json <--- Please edit this file if you want a PWA
│ ├── postcss.config.js <--- Post css config
│ ├── sw.config.js <--- The service worker config file
│ ├── webpack.common.js <--- The common Webpack config file for all the environment
│ ├── webpack.dev.js <--- Dev Webpack environment config file
│ ├── webpack.prod.js <--- Prod Webpack environment config file
│ └── webpack.pwa.js
├── _config.yml <--- The Jekyll config file that you need to set up
├── Gemfile
├── Gemfile.lock
├── _i18n <--- Contains your posts and data in the language you need (check below how to remove it)
├── _images <--- Put all your images here, you will access them with this path /assets/images/
│ ├── icon.png <--- Replace this with your icon
│ └── large-icon.png <--- Replace this with your Facebook Open Graph picture
├── icon.png <--- Same with this one
├── _includes
├── index.md
├── _layouts
│ ├── amp.html <--- The layout for Accelerated mobile page
│ ├── blog.html
│ ├── home.html
│ ├── page.html
│ └── post.html
├── LICENSE
├── package.json <--- Update this file with your information especially the name which is used for the meta tags
├── README.md
├── _scss <--- Put your partials here
│ └── _default.scss
├── _src <--- This folder contains your JS and SASS entry points
│ ├── index.js
│ ├── index.scss
│ └── template
│ └── default.html <--- Here is the main default template, feel free to edit it but do not delete it
├── webpack.config.js
└── package-lock.json
You can see above the basic structure of the boilerplate and the main differences with the official Jekyll folder structure
Configurations
The required configurations are all in _config.yml
Also edit package.json the name is used in the meta tags
If you want a manifest.json file please edit config/manifest.json
Replace the different icon by yours in _images and in the root folder
Assets
SCSS partials should be located in _scss for better reading
Put all your images in _images the content of this folder will be moved to the _site/assets/images so you can access them with this path /assets/images/** in your templates, check the examples
Put all your Javascript files inside _src and import them from index.js or you can also add them as a new entry point in your webpack configuration file
Internationalization
All the posts should be there in inside _i18n folder inside its language, check the boilerplate examples
You can put your variables inside _i18n/en.yml (replace en with your language) and call them in your template with {% t variable_name.sub_variable %}
You can remove the plugin by removing gem 'jekyll-multiple-languages-plugin' from gemfile and jekyll-multiple-languages-plugin from plugins in _config.yml
We invite you to read the very good official documentation of the plugin Jekyll multiple language plugin
Build
Optimized website
To build the website run the following line
npm run build
The built website will be in _site folder.
You can also run a local server to test it with this command
npm run serve:dist
PWA
If you want to build a PWA (including the manifest.json and the service worker) run the following. Please ensure to have configured this file config/manifest.json
The built website will be in _site folder.
npm run build:pwa
Clean assets & _site folders
This will remove the generated folders
npm run clean:project
Known issues
Jekyll watch doesn't reload / rebuild when a translation file is updated inside _i18n folder, I recommand to remove jekyll-multiple-languages-plugin if you don't want a multi language website and if you want to watch / rebuild faster. Otherwise close and start npm run start to rebuild and see your changes from _i18n
Wsl2 requires to run sudo apt install -y build-essential libpng-dev in order to fix the pngquant failed to build, make sure that libpng-dev is installed issue
请发表评论