Git Product home page Git Product logo

jekyll-slim's Introduction

Jekyll-slim

Gem Version Dependency Status Code Climate Build Status

A gem that adds slim-lang support to Jekyll. Works for for pages, includes and layouts.

Installation

Add this line to your Gemfile:

gem 'jekyll-slim'
gem 'slim', github: 'slim-template/slim'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jekyll-slim

In your Jekyll project's _plugins directory:

# _plugins/jekyll-slim.rb
require 'jekyll-slim'

Important!

This gem requires slim from the github master branch for now.

Usage

The gem will convert all the .slim files in your project's directory into HTML. That includes files in sub-directories, includes and layouts. Example:

# _layouts/default.slim
html
  head
  body
    .content-wrapper {{ content }}

To include a partial, use the slim liquid tag instead of include:

# index.slim
---
layout: default
---

section.content Content goes here.
% include footer.slim

Options

Is possible to set options available for Slim engine through the slim key in _config.yml. Example:

# _config.yml
slim:
  pretty: true
  format: html5

Context

The slim context is set to acess a SlimContext object which has a site method, used to access config. Be careful because this is a breaking change.

This allows you to access configuration information in your slim file. Example:

html
  head
  body
    .content-wrapper
      = "slim pretty mode: #{ site.config['slim']['pretty'].to_s }"

The SlimContext object will be kept across calls, allowing you to easily set @instance_variables that can be accessed by all slim files even those included with the slim liquid tag. Those are more or less global variables in slim templates, so be careful when you use them.

Looking for maintainers

We are looking for maintainers for this gem.

Credit

Jekyll-slim was heavily inspired by jekyll-haml. It is free software, and may be redistributed under the terms specified in the LICENSE file.

jekyll-slim's People

Contributors

minad avatar fire-dragon-dol avatar dmitryzuev 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.