Giter Club home page Giter Club logo

sbt-dustjs-linkedin's Introduction

sbt-dustjs-linkedin

Build Status

An SBT plugin to compile Dustjs templates.

This plugin is a continuation of play-dustjs built for sbt-web and Play 2.3.x.

Installation

Add the sbt plugin to your project/plugins.sbt file:

addSbtPlugin("com.jmparsons.sbt" % "sbt-dustjs-linkedin" % "1.0.3")

Usage

Install dust-core

Include the core dust file using webjars:

libraryDependencies ++= Seq(
  "org.webjars" % "dustjs-linkedin" % "2.4.0-1"
)

The webjars path will look like this:

<script src="@routes.Assets.at("lib/dustjs-linkedin/dust-core.js")"></script>

Or include the dust core file manually from LinkedIn Dustjs.

<script src="@routes.Assets.at("javascripts/dust-core-2.4.0.js")"></script>

Add your templates

Place your template .tl files anywhere inside of the app/assets/ it will be available in the corresponding directory. If placed into app/assets/templates/ the output would be target/web/public/main/templates/.

Pull in the generated javascript template file:

<script src="@routes.Assets.at("templates/example.js")"></script>

Example requirejs loading config:

require.config
  paths:
    dust: "../lib/dustjs-linkedin/dust-core"
  shim:
    "../templates/example":
      deps: ["dust"]

require ["dust", "../templates/example"], () ->

Render the template:

$(function() {
  $.get('@routes.Application.data', function(data) {
    console.log('data = ' + JSON.stringify(data));
    dust.render('example', data, function(err, out) {
      $('#dust_pan').html(err ? err : out);
    });
  });
});

Example project with RequireJS using play-dustjs: https://github.com/jmparsons/play-scala-backbone-todo

Changelog

1.0.3 - August 5, 2014

  • Add Windows compatibility

1.0.2 - July 9, 2014

  • Reverted away from transpiler to have more control
  • Fixed source file mapping bug

1.0.1 - July 7, 2014

  • Updated to dustjs-linked version 2.4.0
  • Added webjar as npm module
  • Removed dependency for npm installed dust

1.0.0 - May 19, 2014

  • Inital commit
  • Added tests using sbt scripted

License

MIT: http://jmparsons.mit-license.org - @jmparsons

sbt-dustjs-linkedin's People

Watchers

 avatar  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.