Skip to content

marslabtron/mako-pipeline

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mako-pipeline

A sort of django-pipeline, but for mako.

Install

mako-pipeline is avaiable on pypi:

$ pip install mako-pipeline

Usage

On your python script, call mako_pipeline.configure to setup file mapping:

from mako_pipeline import configure

configure({
    'debug': True,
    'javascript': {
        'final-js': ['file1', 'file2']
    }
})

On templates, import the module using namespace tag and use like following:

<%namespace name="assets" module="mako_pipeline.assets" />

<%assets:tag name="final-js" args="ASSETS_URL" %>
  <script src="${ASSETS_URL}"></script>
<%/assets:tag%>

License

This project is licensed under MIT license (please see LICENSE file).

Some random thoughts

  • when compressing css, delegate the task to scss/less/etc
  • when compressing js, delegate the task to uglifyjs2/yui/etc
  • when writing files, include the md5/sha1/etc on filename
  • use a manifest file to control how img/css/js urls will be generated (write the hashes there)

` CONFIG = { 'debug': True, 'media_url': '/media/', 'js': { 'main': ['file1.js', 'file2.js'], }, 'css': { 'main': ['fila1.css', 'file2.css'], }, } $ tornado-pipeline --help --compress-css --compress-js --compress-all`

About

Control your web assets on mako templates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%