Skip to content

Commit

Permalink
Add BrowserSync
Browse files Browse the repository at this point in the history
  • Loading branch information
RobLoach committed Dec 21, 2016
2 parents 1338d83 + c2498d4 commit a92e3ce
Show file tree
Hide file tree
Showing 81 changed files with 383 additions and 9,614 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
node_modules
build
npm-debug.log
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -4,7 +4,6 @@ sudo: false

node_js:
- "4"
- "5"
- "6"

notifications:
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,30 @@
# Changelog

## 2.2.4: 2016-12-19

- Update Twig

## 2.2.3: 2016-12-16

- Used engineOptions for Twig namespaces

## 2.2.2: 2016-12-16

- Updated dependencies, with engine-specific options

## 2.2.1: 2016-12-15

- Adds Twig Namespace support for KSS

## 2.2.0: 2016-12-15

- Introduces kalastatic.yaml kss->config file use
- From @thiagodemellobueno

## 2.1.16: 2016-12-14

- Use strict

## 2.1.15: 2016-12-13

- Allow changing the KSS homepage
Expand Down
20 changes: 11 additions & 9 deletions README.md
Expand Up @@ -40,7 +40,7 @@ html(lang="en")

### Configuration

KalaStatic can be configured through a `kalastatic.yml` file. The default options are as follows:
KalaStatic can be configured through a `kalastatic.yaml` file. The default options are as follows:

``` yml
# The base directory of where the base KalaStatic lives.
Expand All @@ -55,14 +55,16 @@ destination: 'build',
# The options to pass off to the Metalsmith plugins when building, keyed by plugin name.
pluginOpts: {}

# Where the final CSS will be built out to. This is used for the Styleguide.
css: '../main.css',

# Additional sources to read for KSS documentation for the styleguide.
kssSource: [],

# KSS Builder; Defaults to Twig.
builder: false
# KSS Styleguide Configuration
kss:
# Set the path to a custom KSS Builder
builder: null
title: "Styleguide"
homepage: styles/homepage.md
css: ../styles/main.css
source:
- src/components/
- src/styles/
```

### Build
Expand Down
25 changes: 18 additions & 7 deletions bin/kalastatic
@@ -1,4 +1,5 @@
#!/usr/bin/env node
'use strict';

/**
* Module dependencies.
Expand All @@ -7,8 +8,8 @@
var KalaStatic = require('..')
var program = require('commander')
var nconf = require('nconf')
var fs = require('fs')
var path = require('path')
var browserSync = require('browser-sync')

function retrieveConfig(options) {
nconf.argv()
Expand Down Expand Up @@ -44,11 +45,14 @@ program
.description('Watch and serve KalaStatic')
.option('-c, --config <file>', 'set the configuration file, defaults to kalastatic.yaml')
.action(function (options) {
var conf = retrieveConfig(options);
var kalastatic = new KalaStatic(conf);
var kalastatic = new KalaStatic(retrieveConfig(options));
var conf = kalastatic.nconf
var bs = browserSync.create('kalastatic')

var build = function () {
kalastatic.build().catch(function (err) {
kalastatic.build(function () {
bs.reload()
}).catch(function (err) {
console.error(err)
})
}
Expand All @@ -57,10 +61,17 @@ program

var base = conf.get('base') || '.'
var source = conf.get('source') || 'src'
var finalSource = path.join(base, source)
fs.watch(finalSource, {recursive: true}, function () {
build();
var destination = conf.get('destination') || 'build'
var finalSource = path.join(base, source, '**')
var finalDest = path.join(base, destination)
console.log(base, destination,source)

bs.init({
server: finalDest,
index: 'index.html',
serveStatic: ['.']
})
bs.watch(finalSource).on('change', build)
})

if (!process.argv.slice(2).length) {
Expand Down
1 change: 0 additions & 1 deletion kalastatic.yaml

This file was deleted.

16 changes: 8 additions & 8 deletions package.json
Expand Up @@ -2,32 +2,32 @@
"name": "kalastatic",
"description": "KalaStatic static-site prototyping framework",
"repository": "https://github.com/kalamuna/kalastatic.git",
"version": "2.1.15",
"version": "2.2.4",
"license": "MIT",
"files": [
"src",
"bin"
],
"main": "src/kalastatic.js",
"dependencies": {
"browser-sync": "^2.18.5",
"commander": "^2.9.0",
"concurrently": "^3.1.0",
"extend": "^3.0.0",
"extend-shallow": "^2.0.1",
"for-each": "^0.3.2",
"jstransformer-commonmark": "^0.3.1",
"jstransformer-precss": "^0.1.0",
"jstransformer-pug": "^0.2.2",
"jstransformer-scss": "^0.1.4",
"jstransformer-twig": "^1.2.0",
"jstransformer-twig": "^1.3.0",
"kss": "^3.0.0-beta.16",
"metalsmith": "^2.3.0",
"metalsmith-assets-convention": "^1.1.0",
"metalsmith-collections-convention": "^1.1.1",
"metalsmith-concat-convention": "^1.1.0",
"metalsmith-env": "^2.0.0",
"metalsmith-ignore": "^0.1.2",
"metalsmith-jstransformer": "^0.9.0",
"metalsmith-jstransformer-partials": "^1.2.2",
"metalsmith-jstransformer": "^0.10.0",
"metalsmith-jstransformer-partials": "^1.2.3",
"metalsmith-metadata-convention": "^1.0.1",
"metalsmith-paths": "^3.0.1",
"nconf": "^0.8.4",
Expand All @@ -44,9 +44,9 @@
},
"scripts": {
"test": "node test",
"posttest": "xo --space bin src test/index.js",
"posttest": "xo --space --no-semicolon test",
"examples": "cd examples/mdl-blog && npm i && npm test",
"start": "./bin/kalastatic start"
"start": "cd test/fixtures/start && ../../../bin/kalastatic start"
},
"bin": {
"kalastatic": "./bin/kalastatic"
Expand Down

0 comments on commit a92e3ce

Please sign in to comment.