Twigger ist a simple static site generator using Twig and SCSS.
My problem building a simple static HTML website was that...
- ... I don't want to have redundant HTML
- so Twigger uses Twig that can include Twig templates.
- ... I don't want to write plain CSS
- so Twigger used SCSS, that is compiled and compressed to CSS by default.
- ... I don't want to have bloated JavaScript files
- so Twigger automatically minifies JavaScript by default.
Command / Arguments | Description |
---|---|
-h, --help |
Show help screen |
-v, --version |
Show installed version |
init |
Init twigger in current directory |
build |
Build current twigger application |
serve |
Serve current twigger application |
clear |
Clears the public directory |
Install globally from NPM:
npm i -g twigger
The following configuration is used by default:
cssOutputStyle: "compressed"
minifyJs: true
cssSourceMap: true
templateVariables: { }
- Type:
String
- Values:
"expanded"
,"compressed"
- Default:
compressed
- Type:
Boolean
- Default:
true
- Type:
Boolean
- Default:
true
Template variables can be globally accessed in your project's Twig files.
- Type:
Object
- Default:
{ }
You can override it by editing the twigger-config.yaml
in your project's root directory.
After initializing your twigger project, the following structure is built:
Directory | Description |
---|---|
public/ |
Contains the built application. Can be cleared with twigger clear . |
src/assets/ |
Assets directory that is synced to the public directory. |
src/js/ |
Each JavaScript file is optionally minified and written to the public directory. |
src/pages/ |
Twig pages that are each rendered to HTML files in the public directory. |
src/includes/ |
Twig templates that are included by Twig pages. |
src/styles/ |
SCSS styles that is optionally minified and written to the public directory as style.css . |
- Install twigger globally
npm i -g twigger
- Create a new project directory
mkdir my-new-project && cd my-new-project
- Initialize project
twigger init
- Serve the application on
localhost:8080
twigger serve
- Build the application
twigger build
Jannik Hauptvogel <JannikHv@gmail.com>