Skip to content

mojular/templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mojular templates

A collection of base layout templates for multiple template languages (ERB, Django, Jinja). Also common Jinja macros and Rails/Padrino partials.

Installation

Add as depencency to your project’s package.json:

npm install mojular/templates --save

Usage

See examples of using templates with different frameworks.

Django

For version >=1.8 add the path to your TEMPLATES list in the settings file:

TEMPLATES = [
    {
        ...
        'DIRS': [
            root('templates'),
            abspath(root(project_root, 'node_modules', 'mojular-templates')),
        ],
        ...
    },
]

For versions <1.8 add the following:

TEMPLATE_DIRS = (
    root('templates'),
    abspath(root(project_root, 'node_modules', 'mojular-templates'))
)

Then extend your templates from Mojular base template.

Jinja

{% extends 'layouts/jinja/external.html' %}

Django

{% extends 'layouts/django/external.html' %}

ERB

Add the following to app/controllers/application_controller.rb

layout 'erb/base'

prepend_view_path(File.expand_path("#{Rails.root.to_s}/node_modules/mojular-templates"))

external is for public use and internal is for internal projects.

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages