Code Monkey home page Code Monkey logo

dieter's Introduction

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 concatiating 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.2.0"]

Insert it into your ring middleware stack

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

Or if you use noir

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

Concatination 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, framework.js in any subdirectory, 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 "javascripts/app.js" config-options)

Configuration Options

:compress   false
:asset-roots ["resources"]          ; must have a folder called 'assets'
:cache-root "resources/asset-cache" ; compiled assets are cached here
:cache-mode :development            ; or :production. :development disables cacheing
:log-level  :normal                 ; or :quiet

Dieter searches 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 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.

Breaking Changes

Version 0.2.0

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

dieter's People

Contributors

pbiggar avatar anaisbetts avatar sridatta avatar bostonaholic avatar

Watchers

James Cloos 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.