Jekyll on Scalingo

Using Jekyll

Jekyll is a static site generator written with Ruby. In order to generate your static files, you need a Ruby environment, and a Node.js environment to serve the files, as seen before.

As Scalingo provides Multi Buildpacks support, you can combine the two environments needed to build your application. To achieve this, you can add a .buildpacks file at the root of your project, containing the Ruby buildpack, and the Node.js buildpack:

https://github.com/Scalingo/ruby-buildpack
https://github.com/Scalingo/nodejs-buildpack

The procedure is very similar to the one explained in the static files hosting page. But here we add a build task to our package.json file, which builds your Jekyll application:

{
  "name" : "my-application",
  "version" : "1.0.0",
  "dependencies" : {
    "express" : "4.x"
  },
  "scripts" : {
    "build": "bundle exec jekyll build",
    "start": "node server.js"
  }
}

Adapt your server.js file just a bit, in order to make the .html extension in your URL optional:

var express = require('express');

var app = express();
var directory = '/' + (process.env.STATIC_DIR || 'dist')
app.use(express.static(__dirname + directory), { extensions: 'html'});

var port = process.env.PORT || 3000;
app.listen(port, function () {
  console.log('Listening on', port);
});

And your app is now ready to go!


Suggest edits

Jekyll on Scalingo

©2024 Scalingo