<commit_before># Vuetalisk

Vuetalisk is a Static Site Generator based on `Static API` for  Vue.

A basic idea is that Vuetalisk just writes a static JSON API from jekyll/hexo like markdown pages,
then Vue can fetch and `vuetify` them.

![vuetalisk](http://i.imgur.com/3QUaAyo.png)

# Install

Since Vutalisk proive a set of commands, let's install it globally

```
npm install -g vuetalisk
```

You need to install it locally per each project
`vue init qgp9/vuetalisk-nuxt` and `vue init qgp9/vuetalisk-vue` will come soon.
```
npm install --save vuetalisk
// or
yarn add vuetalisk
```

# Set up
Vuetalisk needs a configuraion file `vuetalisk.config.js` on root directory of a project.

Basically the configuration needs four functions.
```js
const Vuetalisk = require('vuetalisk')

/**
 * Configurations for site
 * External js/Json/Yaml/Toml file can be used also
 */
const _config = {
  source_dir: 'site',  // source directoy contains posts, pages, static files
  target_dir: 'dist',  // target  directory to write API, HTML end points, also static files
  api_point: 'api',    // API directory name under `target_dir`
  title: 'Vuetalisk',  // Site title
  description: 'Static Site Generator for Vue', // Site Description
  permalink: '/:year/:month/:day/:title',       // Global format of permalink. This can be overrided by each collection
  // In Vuetalisk, every things are categorized as a collection
  collections: {
    posts: { // posts collection
      type: 'page',
      path: '_posts',
      list: '/posts/list'
    },
    pages: {  // collection named 'pages'
      tyle: 'page',
      path: '.',
      permalink: '/:path',
      list: '/pages/list'
    },
    static: {
      type: 'file',
      extensions: '*',
      path: '_static',
      permalink:  '/:path'
  },
  github: {
    repo: 'https://github.com/qgp9/Vuetalisk' 
  },
}

/**
 * Configuration function
 */
const config = () =>
  (new Vuetalisk)
    .setRoot(__dirname)
    .configure(_config) // for a external configuration file, simply put a filename. `.configure('_config.yml')`

/**
 * Init function. `config()` should be invoked in the begining
 */
const init = () => 
  config()
    .useStore('store', '.store.json')

/**
 * Build API. scan collections, process items/lists, Write API, remove deleted files
 */
const buildApi = () =>
  init()
    .use('file-loader')
    .use('frontmatter')
    .use('filename-handler')
    .use('url-handler')
    .use('list-handler')
    .use('api-writer')
    .use('static-handler')
    .use('cleaner')

/**
 * Build Vue/Nuxt, Pages.
 */
const buildPage = () =>
  init()
    .use('nuxt-generator')

module.exports = {config, init, buildApi, buildPage, _config}
```<commit_msg>[wip] update README<commit_after># Vuetalisk

Vuetalisk is a Static Site Generator based on `Static API` for  Vue.

A basic idea is that Vuetalisk just writes a static JSON API from jekyll/hexo like markdown pages,
then Vue can fetch and `vuetify` them.

![vuetalisk](http://i.imgur.com/3QUaAyo.png)

# Install

Since Vutalisk proive a set of commands, let's install it globally

```
npm install -g vuetalisk
```

You need to install it locally per each project
`vue init qgp9/vuetalisk-nuxt` and `vue init qgp9/vuetalisk-vue` will come soon.
```
npm install --save vuetalisk
// or
yarn add vuetalisk
```

# Set up
Vuetalisk needs a configuraion file `vuetalisk.config.js` on root directory of a project.

Basically the configuration needs to expose four functions `config`, `init`, `buildApi`, `buildPage`.
```js
const Vuetalisk = require('vuetalisk')

/**
 * Configurations for site
 * External js/Json/Yaml/Toml file can be used also
 */
const _config = {
  source_dir: 'site',  // source directoy contains posts, pages, static files
  target_dir: 'dist',  // target  directory to write API, HTML end points, also static files
  api_point: 'api',    // API directory name under `target_dir`
  title: 'Vuetalisk',  // Site title
  description: 'Static Site Generator for Vue', // Site Description
  permalink: '/:year/:month/:day/:title',       // Global format of permalink. This can be overrided by each collection
  // In Vuetalisk, every things are categorized as a collection
  collections: {
    posts: { // posts collection
      type: 'page',
      path: '_posts',
      list: '/posts/list'
    },
    pages: {  // collection named 'pages'
      tyle: 'page',
      path: '.',
      permalink: '/:path',
      list: '/pages/list'
    },
    static: {
      type: 'file',
      extensions: '*',
      path: '_static',
      permalink:  '/:path'
  },
  github: {
    repo: 'https://github.com/qgp9/Vuetalisk' 
  },
}

/**
 * Configuration function
 */
const config = () =>
  (new Vuetalisk)
    .setRoot(__dirname)
    .configure(_config) // for a external configuration file, simply put a filename. `.configure('_config.yml')`

/**
 * Init function. `config()` should be invoked in the begining
 */
const init = () => 
  config()
    .useStore('store', '.store.json')

/**
 * Build API. scan collections, process items/lists, Write API, remove deleted files
 */
const buildApi = () =>
  init()
    .use('file-loader')
    .use('frontmatter')
    .use('filename-handler')
    .use('url-handler')
    .use('list-handler')
    .use('api-writer')
    .use('static-handler')
    .use('cleaner')

/**
 * Build Vue/Nuxt, Pages.
 */
const buildPage = () =>
  init()
    .use('nuxt-generator')

module.exports = {config, init, buildApi, buildPage}
```
{'fraction_non_alphanumeric': 0.13973959288465065, 'fraction_numerical': 0.0014670823399963323, 'mean_word_length': 3.131818181818182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4566296', 'n_tokens_mistral': 1841, 'n_tokens_neox': 1741, 'n_words': 567}