Giter Site home page Giter Site logo

sourcejs-spec-dependencies's Introduction

Spec Dependencies (crosslinks)

Gitter chat

Spec Dependencies is SourceJS plugin for adding crosslinks section into each spec. It predicts used specs through the css selectors used in current spec.

image

Compatible with SourceJS 0.6.x. For older versions use 0.1.x branch.

Install

To install, run npm in SourceJS project folder:

npm install sourcejs-spec-dependencies --save

Restart the app, and you're ready to go.

How to use

Configuration

By default plugin will parse documentation pages located in /specs folder, to extend the search folder list, update plugin options in /options.js:

{
  plugins: {
    specDependenciesTree: {
      includedDirs: ['specs', 'more-specs']
    }
  }
}

This conf will ensure that plugin checks both /specs and /more-specs folders to build the dependency tree.

Manually set spec dependencies

Spec Dependencies automatically predicts all specs, that used in current spec by comparing CSS classes names with existing Spec names. If you also want to see next section to check which specs use current ("this spec used by"), you have to update info.json of the specs with "usedSpecs" property. Value of "usedSpecs" should be an array even for only element.

// info.json of Example spec (/url/to/example/spec)
{
  "author": ...,
  "title": ...,
  ...,
  "usedSpecs": ["/url/to/used/spec", "/url/to/used/spec1", ...]
}

Next, SourceJS core builds inverted dependencies tree and save it to data/spec_dependencies_tree.json:

{
    "/url/to/used/spec": [
        "/url/to/example/spec"
    ],
    "/url/to/used/spec1": [
       "/url/to/example/spec"
    ]
}

After that plugin uses this tree to build the "this spec used by" section.

sourcejs-spec-dependencies's People

Contributors

jesprider avatar robhrt7 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.