Giter Site home page Giter Site logo

noflo-jekyll's Introduction

noflo-jekyll Build Status

Flow-based reimplementation of the Jekyll static site generator. This provides several advantages for Node.js and especially NoFlo developers:

  • Pure JavaScript, no need for Ruby or other runtimes in your environment. Especially handy if you're using Grunt for site generation
  • Other data sources, in NoFlo everything is just a flow of data. You could easily plug in other data sources than the file system. For example, database query results
  • Different converters, don't want to use Markdown? Just plug in your own mark-up processor component
  • Different template engines, don't want to use Liquid? Just plug in your own template processor component
  • Use as library or executable, this Jekyll implementation is just a NoFlo graph. You can use it in other NoFlo applications, as a Node.js module, or as a command-line executable

However, as with any reimplementation of a application being actively developed, there are also some potential caveats to observe.

Structure

NoFlo Jekyll has been implemented as a NoFlo graph. Most of the logic is handled by various existing NoFlo components, but there are also some places where implementing things as a custom component made sense. Over 85% of the codebase is completely reusable, however.

Here is how the main flow looks like when visualized using NoFlo UI:

Main process flow

You can find the main flow and the different subgraphs from the graphs folder.

Installation

If you want to use this as a command-line executable, then the easiest option is to install it globally with:

$ npm install -g noflo-jekyll

If you want to use it as a library inside a bigger application, then just install it as a dependency by:

$ npm install noflo-jekyll --save

Command-line usage

Since this project aims for feature parity with Jekyll, the command-line usage is similar. To generate a site, run:

$ noflo-jekyll source_dir target_dir

Usage in Node.js applications

The site generation graph can also be used as a library in Node.js applications.

var Jekyll, generator;
Jekyll = require('noflo-jekyll').Jekyll;

// Prepare the site generator
generator = new Jekyll('source_dir', 'target_dir');

// Event handling
generator.on('start', function () {
  console.log("Build started");
});

generator.on('error', console.error);

generator.on('end', function (end) {
  var seconds = end.uptime / 1000;
  console.log("Build finished in " + seconds);
});

// Start the process
generator.run();

Usage in NoFlo graphs

The main site generation flow is exposed as the jekyll/Jekyll graph. Here is a simple example of using it in another graph:

# Directory setup
'/some/source/directory' -> SOURCE Generator(jekyll/Jekyll)
'/some/target/directory' -> DESTINATION Generator()

# Outputs
Generator() GENERATED -> IN Drop(Drop)
Generator() ERRORS -> IN Display(Output)

Known issues and differences with Ruby Jekyll

Template incompatibilities

The Liquid Templating library we use, liquid-node does not cover 100% of the Liquid spec, so some template parameters that work with Jekyll might not yet work.

We're working with the liquid-node developers to improve the coverage, and this is something you can also help with. Please report an issue if you are using something that doesn't work!

Newer Jekyll features

When this project was started, Jekyll was still in the pre-1.0 stage, and its development had stopped. Since then, its development resumed, and 1.0 added features that we don't yet provide. These include:

  • Draft posts
  • Timezones
  • Baseurl

Please report any issues you encounter with these or other Jekyll features.

No web server

The Ruby Jekyll includes a rudimentary web server for testing purposes. As that is outside of the scope of static site generation, this feature was not included into the NoFlo Jekyll implementation. You can serve the generated pages in many ways, including grunt-contrib-connect, simple-server, or NoFlo webserver.

Testing and development

Pull requests are welcome for any missing Jekyll features or other issues! If you want to work with the repository, it is best to be able to test it locally.

Our main body of tests consists of a Jekyll website source in test/fixtures/source that we have generated to a static site with the Ruby Jekyll. We run NoFlo Jekyll against the same sources, and check that the results are identical (save for some whitespace differences).

If you find things NoFlo Jekyll doesn't handle correctly, add them to that Jekyll site source, and then run Ruby Jekyll fixture regeneration with:

$ grunt jekyll

After this you should be able to run the tests with:

$ grunt test

noflo-jekyll's People

Contributors

bergie avatar d4tocchini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

noflo-jekyll's Issues

noflo-jekyll usage via API

We'd like to call noflo-jekyll via an API passing it the sources and getting back the rendered result instead of passing it source and target directory names.

getting noflo-jekyll running

I tried to get it running to build flowhub et al locally. First issue was that I had to run npm install -g coffee-script. Second issue seems deeper:

$ noflo-jekyll flowhub.io/ build/
NoFlo Jekyll /Users/f/src/flowhub.io -> /Users/f/src/build

/Users/f/bin/npm/lib/node_modules/noflo-jekyll/node_modules/noflo-routers/node_modules/nohoarder/lib/cache_storage.coffee:104
        throw new Error("No cache with key " + key + " to locate");
              ^
Error: No cache with key null to locate
  at _ref (/Users/f/bin/npm/lib/node_modules/noflo-jekyll/node_modules/noflo-routers/node_modules/nohoarder/lib/cache_storage.coffee:57:7)

...

npm installs NoFlo 0.4.5 instead of the 0.5.x version in package.json

After installing this module through npm I got "object has no method..." errors similar to this one:

Assuming that the causes were similar, I checked which NoFlo version was installed as a dependency, and as expected it did turn out to be a pre-0.5 version. However the package.json file correctly lists 0.5.x. Any idea why my npm reverts back to the 0.4.5 version anyway?

Did the concept editor in the readme ever get implemented?

Hey, kind of unrelated question but did this editor ever actually get made? Or is it just a concept art piece for the Kickstarter? It looks entirely different than the noflo editor that exists today, and I can't find any information as to why there is a discrepancy.

I would love to play with it - it's absolutely gorgeous. Figured this was the best place to ask since the Jekyll example is the only place I can find it.

Error on run: Object #<ParseMarkdown> has no method 'getIcon'

I wanted to try out noflo-jekyll.
When I run noflo-jekyll source _site, I get the following error:

/Users/balint/.nvm/v0.10.13/lib/node_modules/noflo-jekyll/node_modules/noflo/lib/ComponentLoader.js:165
      if (instance.getIcon()) {
                   ^
TypeError: Object #<ParseMarkdown> has no method 'getIcon'

I have installed noflo and noflo-jekyll globally today.

env: coffee: No such file or directory

Followed the README directions:

$ node -v
v0.10.32
$ npm -v
2.1.3
$ npm install -g noflo-jekyll
[snip]
$ noflo-jekyll . _site
env: coffee: No such file or directory

Is there a step about installing coffee-script missing from the README?

where is the source_dir?

hi.
i run "npm install -g noflo-jekyll",then run "/root/npm/bin/noflo-jekyll"
as3:~# /root/npm/bin/noflo-jekyll
Usage: $ noflo-jekyll source_dir target_dir

where is the source_dir?i can't find it.
tks

I get a "No inport 'content' defined in process Parse (DATA -> CONTENT Parse())"

I'm new to many things including NoFlo, qhen I do:

 ./node_modules/.bin/noflo-jekyll kk jj

I get

/home/ncesar/blog/node_modules/noflo-jekyll/node_modules/noflo/lib/Network.js:224
          throw new Error("No inport '" + port + "' defined in process " + pro
                ^
Error: No inport 'content' defined in process Parse (DATA -> CONTENT Parse())
    at Network.connectPort (/home/ncesar/blog/node_modules/noflo-jekyll/node_modules/noflo/lib/Network.js:224:17)
    at Network.addEdge (/home/ncesar/blog/node_modules/noflo-jekyll/node_modules/noflo/lib/Network.js:354:12)
    at Graph. (/home/ncesar/blog/node_modules/noflo-jekyll/node_modules/noflo/lib/Network.js:350:24)
    at Graph.g (events.js:180:16)
    at Graph.EventEmitter.emit (events.js:117:20)
    at /home/ncesar/blog/node_modules/noflo-jekyll/node_modules/noflo/src/components/Graph.coffee:146:24
    at process._tickCallback (node.js:415:13)

Seems that is all broken! I get the same this

noflo list .

How should I report this error? I follow http://noflojs.org/documentation/ for the installation, but I might have a set of version that could be difficult to reproduce.

This is a Debian Jessie (Testing) since it includes npm

Running Tests

when executing the tests via:

$ nodeunit test

i'm getting the following errors for Jekyll.coffee:

Jekyll
{ [Error: ENOTEMPTY, rmdir '/git/the-grid/noflo-jekyll/test/fixtures/noflo']
  errno: 53,
  code: 'ENOTEMPTY',
  path: '/git/the-grid/noflo-jekyll/test/fixtures/noflo' }
✖ test that NoFlo generates same files as Jekyll

AssertionError: NoFlo didn't generate file /bar.html
    at Object.assertWrapper [as fail] (/usr/local/lib/node/nodeunit/lib/types.js:83:39)
    at checkFile (/git/the-grid/noflo-jekyll/test/Jekyll.coffee:60:12)
    at checkDirectory (/git/the-grid/noflo-jekyll/test/Jekyll.coffee:98:21)
    at Object.exports.test that NoFlo generates same files as Jekyll (/git/the-grid/noflo-jekyll/test/Jekyll.coffee:104:5)
    at wrapTest (/usr/local/lib/node/nodeunit/lib/core.js:231:20)
    at _asyncMap (/usr/local/lib/node/nodeunit/deps/async.js:163:13)
    at async.forEachSeries.iterate (/usr/local/lib/node/nodeunit/deps/async.js:126:25)
    at _asyncMap (/usr/local/lib/node/nodeunit/deps/async.js:160:17)
    at async.series.results (/usr/local/lib/node/nodeunit/deps/async.js:458:34)
    at Network.exports.setUp (/git/the-grid/noflo-jekyll/test/Jekyll.coffee:43:16)

AssertionError: NoFlo didn't generate file /index.html
    at Object.assertWrapper [as fail] (/usr/local/lib/node/nodeunit/lib/types.js:83:39)
    at checkFile (/git/the-grid/noflo-jekyll/test/Jekyll.coffee:60:12)
    at checkDirectory (/git/the-grid/noflo-jekyll/test/Jekyll.coffee:98:21)
    at Object.exports.test that NoFlo generates same files as Jekyll (/git/the-grid/noflo-jekyll/test/Jekyll.coffee:104:5)
    at wrapTest (/usr/local/lib/node/nodeunit/lib/core.js:231:20)
    at _asyncMap (/usr/local/lib/node/nodeunit/deps/async.js:163:13)
    at async.forEachSeries.iterate (/usr/local/lib/node/nodeunit/deps/async.js:126:25)
    at _asyncMap (/usr/local/lib/node/nodeunit/deps/async.js:160:17)
    at async.series.results (/usr/local/lib/node/nodeunit/deps/async.js:458:34)
    at Network.exports.setUp (/git/the-grid/noflo-jekyll/test/Jekyll.coffee:43:16)

✔ test that NoFlo generates only the files Jekyll does

FAILURES: 2/2036 assertions failed (3415ms)

is this something you're working on, or am i running tests the wrong way? it's my first time with nodeunit... i've been using mocha, but have been frustrated with it

are you using the default reporter? gotta those love colored reports!

Inherit page metadata through template path

In Jekyll, page metadata properties are inherited through the template loading path, so if a template a page is using has a YAML front matter property that the page doesn't override, then that should be applied to the page.

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.