• Stars
    star
    134
  • Rank 270,967 (Top 6 %)
  • Language
    Clojure
  • Created almost 13 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Asset pipeline ring middleware

Dieter

Dieter [dee-ter] is a clojure interpretation of the ruby Sprockets library.

Usage

Dieter provides you with a ring middleware which will compile certain static assets. Currently it supports concatenating javascript and CSS files, compiling LESS CSS, CoffeeScript and Haml-coffee. In addition it minifies javascript using the Google Closure compiler.

Add dieter as a dependency in leiningen

[dieter "0.4.1"]

Insert it into your ring middleware stack

(-> app
    (asset-pipeline config-options))

Or if you use noir

(server/add-middleware asset-pipeline config-options)

Concatenation of assets is handled by a Dieter manifest file. A manifest is a file whose name ends in .dieter and whose contents are a clojure vector of file names / directories to concatenate.

For example, a file named assets/javascripts/app.js.dieter with the following contents:

[
  "./base.js"
  "framework.js"
  "./lib/"
  "./models/"
]

Dieter would look for base.js in the same directory, and then concatenate each file from the lib and models directories.

Linkage

In order to include links to your assets you may use the link-to-asset function.

(link-to-asset "stylesheets/reset.css" config-options)
(link-to-asset "javascripts/app.js.dieter" config-options)

Configuration Options

:engine     :rhino                  ; defaults to :rhino; :v8 is much much faster
:compress   false                   ; minify using Google Closure Compiler & Less compression
:asset-roots ["resources"]          ; must have a folder called 'assets'. Searched for assets in the order listed.
:cache-root "resources/asset-cache" ; compiled assets are cached here
:cache-mode :development            ; or :production. :development disables cacheing
:log-level  :normal                 ; or :quiet
:precompiles ["./assets/myfile.js.dieter"] ; list of files for `lein dieter-precompile` to precompile. If left blank (the default), all files will be precompiled, and errors will be ignored.

Dieter checks for your assets in [asset-root]/assets. Compiled assets are always written to the cache-root. In production mode this means that the cached assets are served from the cache. However development-mode assets are always regenerated.

Note you need to pass your config options to asset-pipeline as well as link-to-asset.

Contributing

It is easy to add new preprocessors to dieter. Each preprocessor (CoffeeScript, HamlCoffee, etc) uses the default library for that language, hooked up to dieter using the Rhino JavaScript library. See dieter-core/src/dieter/assets/ for easy-to-follow examples.

Dancing

Now it's time to dance

License

Copyright (C) 2012 EdgeCase

Distributed under the Eclipse Public License, the same as Clojure.

Changes

Version 0.4.0

  • Remove support for searching for filenames, because it has very sharp edges
  • Throw a FileNotFoundException instead of failing silently when files in a manifest aren't found
  • Directory contents are listed in alphabetical order (avoids intermittent failures due to file directory order on Linux)
  • Rewritten internals, with more reliable and consistent string and filename handling
  • Referring to assets using different extensions is no longer supported

Version 0.3.0

  • Use v8 for Less, Hamlcoffee and CoffeeScript
  • Cache and avoid recompiling CoffeeScript and HamlCoffee files which haven't changed
  • Update to lein2
  • Improve stack traces upon failure in Rhino
  • Update Coffeescript (1.3.3), Less (1.3.0) and Hamlcoffee (1.2.0) versions
  • Ignore transient files from vim and emacs
  • Better error reporting of HamlCoffee
  • Support multiple asset directories
  • Add expire-never headers
  • Improve Rhino speed by using one engine per thread
  • Update to latest Rhino for better performance
  • Support for lein dieter-precompile
  • Add mime type headers for dieter files

Version 0.2.0

  • Handlebars templates are now a separate library. dieter-ember

More Repositories

1

middleman-gh-pages

Easy deployment of Middleman sites to Github Pages
Ruby
356
star
2

vim-config

This is the Vim configuration we use on pairing machines at EdgeCase, as well as many personal machines. It's pretty okay.
Vim Script
68
star
3

pairing-config

Standard box config
Ruby
34
star
4

ghpreview

Preview Markdown files (such as a README) exactly how it will appear on Github
Ruby
27
star
5

spotbox

Official jukebox of the EdgeCase lab
JavaScript
13
star
6

glue.js

Implements Object.watch for javascript objects
JavaScript
12
star
7

ff-om-draggable

A draggable component for OM
Clojure
8
star
8

ECJWT

Implementation of JSON Web Token (JWT)
Objective-C
8
star
9

emacs-config

THIS REPO IS NO LONGER MAINTAINED, PLEASE USE neo/emacs-config
Emacs Lisp
8
star
10

nhs-patientlist

NHS patient list
Ruby
7
star
11

authorize_me

This repo is no longer being supported. See README.
Ruby
6
star
12

people_vs_js

The People vs. JavaScript CodeMash Precompiler Session
JavaScript
4
star
13

Pelotonia

Java
4
star
14

validation_matchers

Ruby
3
star
15

sortable-model

This repo is no longer being supported. See README.
Ruby
3
star
16

styleguide

[Neo Columbus] CSS and HTML style guide
Ruby
3
star
17

cocoa_spotify

Objective-C
3
star
18

raphael_v_canvas

Raphael vs Canvas Demo
JavaScript
2
star
19

movienight

Movie night scheduling application
Ruby
2
star
20

vital_testing

Presentation Materials for the Vital Testing Workshop
Ruby
2
star
21

tdd_ruby_training

Test Driven Introduction to Ruby
Ruby
2
star
22

codemash_mobile_smackdown_2012

This is the "ding, it's done!" version of the app. enjoy!
Objective-C
2
star
23

railsconf_refactoring

Ruby
1
star
24

submission_review2

Ruby
1
star
25

glui.js

Jquery Adapter for Glue.js (https://github.com/edgecase/glue.js)
JavaScript
1
star
26

dieter-ember

Compile handlebars templates in a way compatible with Ember.js
Clojure
1
star
27

ecrails_templates

rails_templates
Ruby
1
star
28

training_slides

Technology Slide Decks
Ruby
1
star
29

teststudio

Ruby
1
star
30

mockdialogue

Ruby
1
star
31

codereviewdialogue

Ruby
1
star
32

presentation_securing_your_rails_app

Slides and Notes for the "Securing your Rails App" presentation
1
star
33

serenade_todomvc

The todomvc app written with Serenade.js
CoffeeScript
1
star
34

modelingdialogue

1
star
35

gmail_campfire_bot

Codebase to read from gmail account and post to campfire.
1
star
36

old_edgecase_blog_redirector

Rack middleware to redirect traffic from the old EC blog to the new one
Ruby
1
star
37

tddscreencast

1
star
38

flamethrower

This repo is no longer being supported. See README.
JavaScript
1
star