• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

noflo/noflo-jekyll: Flow-based reimplementation of the Jekyll static site genera ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

noflo/noflo-jekyll

开源软件地址:

https://github.com/noflo/noflo-jekyll

开源编程语言:

CoffeeScript 78.5%

开源软件介绍:

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



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
taylorbryant/jekyll-starter-tailwind: Jekyll starter styled with Tailwind CSS发布时间:2022-07-07
下一篇:
DevTips/Artists-Theme: 发布时间:2022-07-08
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap