 { extname } = require 'path'
 { jsonify } = require './traverse'
 link = require './linker'
+
+extensions =  # defaults
+    json: (tree) ->
+        JSON.stringify(tree)
+    coffee: (tree) ->
+        """link = require 'dt-compiler/linker'
+        tree = #{JSON.stringify tree}
+        module.exports = (rawtemplate) -> link rawtemplate, tree
+        """
+    js: (tree) ->
+        """var link = require('dt-compiler/linker'),
+        tree = #{JSON.stringify tree};
+        module.exports = function (rawtemplate) {
+            return link(rawtemplate, tree);
+        };"""
 
 
 class HTMLCompiler

        # values
        @loaded = no
        @loading = no
        #aliases
        @loadSync = @open

    read: (filename, callback) ->
        fs.readFile filename, (err, data) =>


# exports

HTMLCompiler.extensions = extensions
module.exports = HTMLCompiler

