All Projects → kakulukia → pypugjs

kakulukia / pypugjs

Licence: MIT license
PugJS syntax adapter for Django, Jinja2 and Mako templates

Projects that are alternatives of or similar to pypugjs

Pug
Pug template engine for PHP
Stars: ✭ 341 (+43.88%)
Mutual labels:  template-engine, pug, jade
Jade
Jade.go - pug template engine for Go (golang)
Stars: ✭ 251 (+5.91%)
Mutual labels:  template-engine, pug, jade
tale-pug
Tale Pug is the popular JavaScript Template Engine Pug, formerly Jade, for PHP!
Stars: ✭ 32 (-86.5%)
Mutual labels:  template-engine, pug, jade
Pug As Jsx Loader
Stars: ✭ 168 (-29.11%)
Mutual labels:  pug, jade
idiots.win
Google Autocomplete Guessing Game
Stars: ✭ 26 (-89.03%)
Mutual labels:  pug, jade
Jade Html5 Boilerplate
HTML5 Boilerplate ported to Jade. Great as a drop and go markup skeleton for Express apps.
Stars: ✭ 111 (-53.16%)
Mutual labels:  pug, jade
Gulp Pug Sass Seed
🍹 A Pug and Sass starter project using gulp for task automation.
Stars: ✭ 84 (-64.56%)
Mutual labels:  pug, jade
pug4py
Use Pug.js within any python framework
Stars: ✭ 17 (-92.83%)
Mutual labels:  template-engine, pug
Compile Hero
🔰Visual Studio Code Extension For Compiling Language
Stars: ✭ 169 (-28.69%)
Mutual labels:  pug, jade
Email Templates
📫 Create, preview, and send custom email templates for Node.js. Highly configurable and supports automatic inline CSS, stylesheets, embedded images and fonts, and much more!
Stars: ✭ 3,291 (+1288.61%)
Mutual labels:  template-engine, pug
Phug
Phug - The Pug Template Engine for PHP
Stars: ✭ 43 (-81.86%)
Mutual labels:  template-engine, pug
Node.js Bootstrap Starter Template
Node.js, Express, Pug, Twitter Bootstrap, Starter Template
Stars: ✭ 107 (-54.85%)
Mutual labels:  pug, jade
Wordless
All the power of Pug, Sass, Coffeescript and WebPack in your WordPress theme. Stop writing themes like it's 1998.
Stars: ✭ 1,374 (+479.75%)
Mutual labels:  pug, jade
Laravel Pug
Pug view adapter for Laravel and Lumen
Stars: ✭ 130 (-45.15%)
Mutual labels:  pug, jade
Pug Sass Boilerplate Starter Kit
A Front-end template for building web apps or sites using Pug(Jade) and Sass
Stars: ✭ 92 (-61.18%)
Mutual labels:  pug, jade
Bootstrap3 Pug Former jade Node Express Grunt
Bootstrap 3 templated by Jade
Stars: ✭ 242 (+2.11%)
Mutual labels:  pug, jade
Ines Io
⚡️ Source of my website and blog (Harp, Jade, Sass, JavaScript)
Stars: ✭ 38 (-83.97%)
Mutual labels:  pug, jade
Expug
Pug templates for Elixir
Stars: ✭ 74 (-68.78%)
Mutual labels:  pug, jade
Squirrelly
Semi-embedded JS template engine that supports helpers, filters, partials, and template inheritance. 4KB minzipped, written in TypeScript ⛺
Stars: ✭ 359 (+51.48%)
Mutual labels:  template-engine, pug
Aeromock
Lightweight mock web application server
Stars: ✭ 152 (-35.86%)
Mutual labels:  template-engine, jade

PyPugJS PyPiPackage BuildStatus Coverage

PyPugJS is a fork of PyJade with the name Jade changed to PugJS.

Additional disclaimer: Since the original pypugjs died i took the liberty to keep it alive, because since starting to work with the jade compiler for node I hate writing HTML and want to continue using it in my Django projects. I will keep the existing non Django stuff inside the project, but I cannot support anything other since I'm not actively using it not will be in the foreseable future. Tornado, Mako etc. support will be welcome tho!

PyPugJS is a high performance port of PugJS for python, that converts any .pug source into different Template-languages (Django, Jinja2, Mako or Tornado).

UTILITIES

To simply output the conversion to your console:

pypugjs [-c django|jinja|mako|tornado] input.pug [output.html]

INSTALLATION

To install pypugjs:

pip install pypugjs

Now simply name your templates with a `.pug` extension and this PugJS compiler will do the rest. Any templates with other extensions will not be compiled with the pypugjs compiler.

Framework specific installation instructions

Syntax

Generally the same as the PugJS Node module (except of cases and several other features, which are not implemented) https://github.com/pugjs/pug/blob/master/README.md

Example

This code

!!! 5
html(lang="en")
  head
    title= pageTitle
    script(type='text/javascript').
      if (foo) {
         bar()
      }
  body
    h1.title PugJS - node template engine
    #container
      if youAreUsingPugJS
        p You are amazing
      else
        p Get on it!

Converts to

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>{{pageTitle}}</title>
    <script type='text/javascript'>
      if (foo) {
         bar()
      }
    </script>
  </head>
  <body>
    <h1 class="title">PugJS - node template engine</h1>
    <div id="container">
      {%if youAreUsingPugJS%}
        <p>You are amazing</p>
      {%else%}
        <p>Get on it!</p>
      {%endif%}
    </div>
  </body>
</html>

Convert existing templates online with the HTML2Jade converter.

Register filters

If you want to register a function as a filter, you only have to decorate the function with pypugjs.register_filter("filter_name")

import pypugjs

@pypugjs.register_filter('capitalize')
def capitalize(text, ast):
  return text.capitalize()

Notable Features

Adding conditional classes:

a(class={'active-class': True, 'another': False})

Define mixins like this mixins/foo.pug:

mixin foo(data)
  .foo {{ data }}

And use them in your templates like this:

include mixins/foo.pug

div
  +foo(data)

TESTING

To start the testsuite, start the following commands:

make init
make test

TODOs and BUGS

See: https://github.com/kakulukia/pypugjs/issues

ChangeLog

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].