k-engine
v1.2.4
Published
Static-site engine powering KozTV projects
Readme
k-engine
Static site generator for KozTV projects. Simple and fast tool for creating blogs and portfolios.
Installation
npm install k-engineUsage
Global installation
npm install -g k-engine
k-engine build
k-engine serveLocal usage
npx k-engine build
npx k-engine serveProject Structure
project/
├── content/ # Source content
│ ├── posts/ # Blog posts in Markdown
│ └── projects/ # Projects with images and videos
├── static/ # Static files (CSS, JS, images)
├── templates/ # HTML templates (optional)
├── docs/ # Generated site
└── subscribers.json # Email subscribers listCommands
Build site
npm run buildStart dev server
npm run serveDevelopment mode with auto-rebuild
npm run build -- --watchForce regenerate all images
npm run build -- --force-regenerateClean output directory before build
npm run build -- --cleanFeatures
Automatic image processing
- WebP and AVIF format generation
- Responsive images with different sizes
- Automatic quality optimization
Automatic cleanup
- Removes files from
docs/that no longer exist in source content - Cleans up empty directories
- Real-time change tracking
Hot Reload
- Automatic browser refresh on changes
- BrowserSync for cross-device synchronization
GitHub Pages ready
- Automatic
.nojekyllfile creation - CNAME support for custom domains (configurable)
Configuration
Image settings
In lib/config.js you can configure:
- Generation sizes (default: 480px, 960px)
- Quality for different formats
- Responsive breakpoints
Template customization
- Add
templates/folder in project root - Override
templates/page.htmlto change design
Override static files
- Add
static/folder in project root - Your files will be copied over default ones
CNAME и другие настройки через внешний файл
Создайте k-engine.config.json или config.json в корне проекта. Вы можете переопределить любые параметры:
{
"cname": "your-domain.com",
"sourceDir": "content",
"outputDir": "docs",
"googleAnalytics": "G-XXXXXXXXXX",
"images": {
"sizes": [320, 640, 1280],
"quality": { "webp": 90, "avif": 60 }
}
}Если параметр не задан, используется значение по умолчанию. Если cname не указан или равен null, файл CNAME не будет создан. Если googleAnalytics не указан, Google Analytics не будет подключен.
Publishing to npm
Preparation for publishing
Update version in package.json:
npm version patch # 1.0.3 -> 1.0.4 npm version minor # 1.0.3 -> 1.1.0 npm version major # 1.0.3 -> 2.0.0Check package.json contents:
- Make sure
filescontains all necessary files - Check
binsection for CLI command - Update
descriptionandkeywordsif needed
- Make sure
Test locally:
npm pack npm install -g ./k-engine-1.0.4.tgz k-engine build
Publishing
Login to npm:
npm loginPublish package:
npm publishFor publishing with tag (optional):
npm publish --tag beta
Publishing updates
Update version:
npm version patchPublish:
npm publish
Version rollback (if needed)
Undo last version commit:
git reset --hard HEAD~1Or delete tag:
git tag -d v1.0.4 git push origin :refs/tags/v1.0.4
Dependencies
- Node.js >= 18
- Main packages:
sharp- image processingmarked- Markdown parsingbrowser-sync- dev serverexpress- web serveresbuild- JavaScript bundling
License
MIT
