Giter Site home page Giter Site logo

gulp-slate's Introduction

gulp-slate

node.js with port of tripit/slate to be included in gulp :)

special features

code blocks in main content

will render javascript in main content

usage

Instalation

npm install gulp-slate --save

Gulp Setup

now you can setup a gulp task to handle the build

// inside of gulpfile.js
var gulp = require('gulp');
var slate = require('gulp-slate');

gulp.task('slate', function () {
    return gulp.src(
        [
            'node_modules/gulp-slate/node_modules/slate/source/index.html.md'
        ]
    )
        .pipe(slate())
        .pipe(gulp.dest('dist/'))
    ;
});

First Build

this is really simple since the task is already setup:

gulp slate

now go on and host the dist/ folder somewhere

simple webserver

python -m SimpleHTTPServer 8000

now open http://localhost:8000 in a browser of your choice, result should look exactly like http://tripit.github.io/slate/

Neat Features

If you need different Language groups use an Alias: angular>javascript for javascript highlighting in the angular group

automate development

you can use browserSync

I will now asume that your repository looks like this:

.
├── dist
├── docs
│   ├── custom.scss
│   └── index.html.md
├── gulpfile.js
└── package.json

installation

npm install browser-sync --save

gulpfile.js

var gulp = require('gulp');
var slate = require('gulp-slate');
var browserSync = require('browser-sync').create();

gulp.task('slate', function () {
    return gulp.src('docs/index.html.md')
        .pipe(slate({
            scss: 'docs/custom.scss'
        }))
        .pipe(gulp.dest('dist/'))
        .on('end', browserSync.reload)
    ;
});

gulp.task('serve', ['slate'], function() {

    browserSync.init({
        port: 8080,
        server: {
            baseDir: "./dist"
        }
    });

    gulp.watch('docs/**', ['slate']);
});

run it :)

this will start browserSync, watch for changes inside of docs and refresh your browser!

gulp serve

configuration

constructor(options)

options.assets

add assets to current stream

Type: Boolean

Default true

options.filename

set the filename - warning: only use one input file! else only the last one will show up

Type: String

Default index.html.md will become index.html

options.log

log level: DEBUG|INFO|WARN|ERROR

Type: String

Default WARN

options.style

Highlighting style, use any name from https://github.com/isagalaev/highlight.js/tree/master/src/styles

Type: String

Default solarized-dark

options.template

Template to render - in general you should never need to touch this

Type: String

Default src/layout.html

options.scss

If you need to override certain css parameters, do not forget to include the original app.scss if you change this

Type: String

Default src/app.scss

options.variables

load your own variables, default variables from slate are always loaded first

Type: String

Default null

options.logo

to have a custom logo added to the page

Type: String

Default node_modules/slate/source/images/logo.png

options.includeLoader

where to load includes from, the function receives the name as well as the path to the main markdown file and should return a promise that resolves the file content

Type: Function

Default error will be loaded from includes/_error.md

thanks to

gulp-slate's People

Contributors

wodka avatar alexgoldstone avatar anup-sr avatar justtonytone avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.