Giter Club home page Giter Club logo

grunt-aglio's Introduction

Dependency Status Build Status

grunt-aglio

Grunt plugin to generate aglio documentation

Getting Started

This plugin requires Grunt ~0.4.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-aglio --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-aglio');

The Aglio task

Overview

In your project's Gruntfile, add a section named aglio to the data object passed into grunt.initConfig().

grunt.initConfig({
  aglio: {
    your_target:{
      files:{
        "dest/api.html": ["src/docs/section1.md", "src/docs/section2.md"]
      },
      theme: "default",
      seperator: "\n"
    }
  },
})

Options

options.files

Type: object

An object with the key as the destination file with an array of src files. The src files will be concatted into a single file before being processed.

options.theme

Type: String Default value: default

The theme to use, defaults to the default theme. Possible values are default, flatly, slate and cyborg. You can also pass in the path to your custom Jade templates here. The path is relative to your project root

options.seperator

Type: String Default value: empty string

When multiple source files are provided, the seperator is used to combine them together.

options.filter

Type: Function Default value: function(src){return src;}

The src is passed through this function before passed into aglio. You can use this step to automatically add any tags, CI badges or build revision content into the src. Windows users can take advantage of this function to remove '\r' characters so that snowcrash will parse their files properly

Usage examples

Basic

This configuration allows you to split your API definition across multiple files and have it concatted in.

grunt.initConfig({
  aglio: {
    your_target:{
      files:{
        "dest/api.html": ["src/docs/section1.md", "src/docs/section2.md"]
      },
      theme: "slate"
    }
  },
})

Basic w/ Filter

This allows you to tag your documentation to a particular revision number that you may be using elsewhere

grunt.initConfig({
  aglio: {
    your_target:{
      files:{
        "dest/api.html": ["src/docs/section1.md", "src/docs/section2.md"]
      },
      theme: "slate",
      filter: function(src){
        return "> This documentation is correct as of " + revNum + "\n" + src;
      }
    }
  },
})

Custom Jade Template

This configuration allows you to specify your own jade template. A guide on how to write your own can be found at the aglio repo.

grunt.initConfig({
  aglio: {
    your_target:{
      files:{
        "dest/api.html": ["src/docs/section1.md", "src/docs/section2.md"]
      },
      theme: "slate"
    }
  },
})

Changelog

  • 0.2.0
    • Minor breaking change, paths for custom templates are now relative to the project root, thanks to @chesleybrown.
    • Bump aglio version to 1.14
  • 0.1.7
    • Bump aglio version to 1.13
  • 0.1.6
    • Bump aglio version to 1.12
  • 0.1.5
    • Made the task async, thanks to @ebonlieu

Contributers

  • @ebonlieu
  • @chesleybrown

grunt-aglio's People

Contributors

chesleybrown avatar

Stargazers

 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.