All Projects → kevinbuhmann → Ng Static Site Generator

kevinbuhmann / Ng Static Site Generator

Licence: mit
ng-static-site-generator is a webpack-based command line build tool that builds an Angular app and Jekyll-style blog entry html files into a static html and css website. It also supports building a client app so you can have static pages that are also capable of running dynamic functionality coded in Angular.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ng Static Site Generator

Pendulum
A simple markdown editor for static files (Hugo, Nexo, Jekyll, MkDocs, ...)
Stars: ✭ 157 (+273.81%)
Mutual labels:  jekyll, static-site-generator, static-site
Prerender Spa Plugin
Prerenders static HTML in a single-page application.
Stars: ✭ 7,018 (+16609.52%)
Mutual labels:  webpack, static-site-generator, prerender
Forty Jekyll Theme
A Jekyll version of the "Forty" theme by HTML5 UP.
Stars: ✭ 695 (+1554.76%)
Mutual labels:  jekyll, static-site-generator, static-site
jekyll-skeleton
Scaffolding to start with a Jekyll website
Stars: ✭ 27 (-35.71%)
Mutual labels:  jekyll, static-site-generator, static-site
Eleventy Starter Boilerplate
🚀 Eleventy Starter is production-ready with SEO-friendly for quickly starting a blog. ⚡ Built with Eleventy, ESLint, Prettier, Webpack, PostCSS, Tailwind CSS and Netlify CMS (optional).
Stars: ✭ 139 (+230.95%)
Mutual labels:  webpack, static-site-generator, static-site
Jekyll Doc Theme
Jekyll theme for creating project documentation websites
Stars: ✭ 203 (+383.33%)
Mutual labels:  jekyll, static-site-generator, static-site
Generator Infinitely Static
💫 Static page generator with routes support thats infinitely awesome
Stars: ✭ 11 (-73.81%)
Mutual labels:  webpack, static-site-generator, static-site
Jekyll Boilerplate
Helpful files to get started working on a new Jekyll website
Stars: ✭ 30 (-28.57%)
Mutual labels:  webpack, jekyll, static-site
Peco
nothing here, move on..
Stars: ✭ 213 (+407.14%)
Mutual labels:  webpack, static-site-generator, static-site
Skeleventy
A skeleton boilerplate built with Eleventy.
Stars: ✭ 318 (+657.14%)
Mutual labels:  webpack, static-site-generator, static-site
Microsite
Do more with less JavaScript. Microsite is a smarter, performance-obsessed static site generator powered by Preact and Snowpack.
Stars: ✭ 632 (+1404.76%)
Mutual labels:  static-site-generator, static-site
Headlesscms.org
Source for headlesscms.org
Stars: ✭ 628 (+1395.24%)
Mutual labels:  static-site-generator, static-site
Staticgen
Static website generator that lets you use HTTP servers and frameworks you already know
Stars: ✭ 628 (+1395.24%)
Mutual labels:  static-site-generator, static-site
Jekyll Rss Feeds
Templates for rendering RSS feeds for your Jekyll blog
Stars: ✭ 627 (+1392.86%)
Mutual labels:  jekyll, jekyll-blog
Gatsby Starter Ghost
A starter template to build lightning fast websites with Ghost & Gatsby
Stars: ✭ 752 (+1690.48%)
Mutual labels:  static-site-generator, static-site
Mediumish Theme Jekyll
Jekyll Template - Mediumish
Stars: ✭ 786 (+1771.43%)
Mutual labels:  jekyll, jekyll-blog
Pretzel
A site generation tool (and then some) for .NET platforms
Stars: ✭ 592 (+1309.52%)
Mutual labels:  jekyll, static-site-generator
Thenewdynamic.org
Resources for Designers and Developers using the JAMstack
Stars: ✭ 24 (-42.86%)
Mutual labels:  jekyll, static-site-generator
Jekyll Scholar
jekyll extensions for the blogging scholar
Stars: ✭ 872 (+1976.19%)
Mutual labels:  jekyll, static-site-generator
Jekyll Pug
Jekyll Plugin That Allows You To Use Pug
Stars: ✭ 30 (-28.57%)
Mutual labels:  jekyll, static-site-generator

ng-static-site-generator

Build Status npm version

ng-static-site-generator is a tool for building an Angular app and blog entries into a static html and css website. Building a client app to support dynamic functionality in the browser is also supported.

There is a starter project available. See kevinphelps/kevinphelps.me for another example.

Features

  • [x] Build an Angular app and blog entries into a static html and css website.
  • [x] Build a client app to support dynamic functionality in the browser.
  • [x] Watch build mode to automatically rebuild the site after changes.
  • [x] Generate blog pages from source files written in markdown.
  • [x] AOT build support for the client app to reduce bundle size.
  • [ ] Server for testing the website when developing and writing blog entries. (firebase serve is a good alternative.)

Installation

Clone the starter project to get started fast!

yarn add [--exact] ng-static-site-generator or npm install --save-dev [--save-exact] ng-static-site-generator

The following peerDependencies are required:

{
  "dependencies": {
    "@angular/animations": ">4.0.0",
    "@angular/common": ">4.0.0",
    "@angular/core": ">4.0.0",
    "@angular/http": ">4.0.0",
    "@angular/platform-browser": ">4.0.0",
    "@angular/platform-server": ">4.0.0",
    "@angular/router": ">4.0.0",
    "reflect-metadata": ">0.1.0",
    "rxjs": ">5.0.0",
    "typescript": ">2.3.0",
    "zone.js": ">0.8.0"
  }
}

CLI Commands

  • ng-static-site-generator build: Builds the static site.
  • ng-static-site-generator build --prod: Builds the static site for production (AOT compilation, minify js and html).
  • ng-static-site-generator watch: Builds the static site and rebuilds after changes.

Configuration

ng-static-static-generator is configured via a file named ng-static-static-generator.json at the root of the project.

{
  "distPath": "./dist", // This is where the site will be generated.
  "blogPath": "./src/blog", // This is the folder where your blog entries are located.
  "stylesPath": "./src/styles.scss", // This is the file that contains your global styles.
  "templatePath": "./src/index.html", // This is your template html file. This is passed to HtmlWebpackPlugin.
  "appModule": "./src/app/app.module#AppModule", // This is the path and class name of your AppModule.
  "appRoutes": "./src/app/app-routing.module#routes", // This is the path and export name or your routes.
  "appComponent": "./src/app/app.component#AppComponent", // This is the path and name or your root component.

  // Options for building an optional client app.
  "mainPath": "./src/main.ts", // This is the file that contains the browser bootstrap code.
  "polyfillsPath": "./src/polyfills.ts" // Include this is you need a polyfills bundle.
}

Using the NgStaticSiteGeneratorModule

ng-static-static-generator exposes functionality via the NgStaticSiteGeneratorModule.

// app.module.ts
import { ModuleOptions, NgStaticSiteGeneratorModule } from 'ng-static-site-generator';

const ngStaticSiteGeneratorModuleOptions: ModuleOptions = {
  openExternalLinksInNewTab: false // Automatically add target="_blank" to external links. Default false.
};


@NgModule({
  imports: [
    ...
    NgStaticSiteGeneratorModule.forRoot(ngStaticSiteGeneratorModuleOptions)
  ],
  ...
})
export class AppModule { }

// my-component.component.ts
import { BlogService } from 'ng-static-site-generator';

@Component({
  selector: 'app-my-component',
  templateUrl: './my-component.component.html',
  styleUrls: ['./my-component.component.scss']
})
export class MyComponent {
  constructor(private blogService: BlogService) { }
}

Blog entry source files

ng-static-site-generator uses jekyll-style files for blog entries. Files are placed in the blogPath folder specifed in ng-static-static-generator.json. (Note: Nesting folders within the blog path is not yet supported.)

  • filename: YYYY-MM-DD-url-slug.html or YYYY-MM-DD-url-slug.md (e.g. 2017-06-26-this-is-a-blog-entry.html)
  • file contents: Metadata is given at the top of file delimited by lines containing ---. Everything after the second --- is body content written in html or markdown.

Example:

---
title: This is the Title of the Blog Entry
description: This is a short description of the blog entry.
customProperty: This is a custom property. (Optional, of course.)
---

##This is the Title of the Blog Entry

This is the content of the blog entry.

<p>You can also write content in html if you want.</p>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].