diff --git a/lib/compiler/plugins/jade.js b/lib/compiler/plugins/jade.js
new file mode 100644
index 0000000..8c2f97f
--- /dev/null
+++ b/lib/compiler/plugins/jade.js
@@ -0,0 +1,27 @@
+// Generated by CoffeeScript 1.4.0
+(function() {
+ var jade, syspath;
+
+ syspath = require('path');
+
+ jade = require('jade');
+
+ exports.contentType = 'javascript';
+
+ exports.process = function(txt, path, module, cb) {
+ var builded, name;
+ try {
+ name = syspath.basename(path, '.jade');
+ txt = jade.compileClient(txt, {
+ name: ' ',
+ filename: path,
+ doctype: 'html'
+ });
+ builded = "if (typeof window.QTMPL === \"undefined\") window.QTMPL = {};\nwindow.QTMPL[\"" + name + "\"] = " + txt + ";\nif (typeof module !== \"undefined\") module.exports = window.QTMPL[\"" + name + "\"];";
+ return cb(null, builded);
+ } catch (e) {
+ return cb(e);
+ }
+ };
+
+}).call(this);
diff --git a/package.json b/package.json
index 69c30d6..75ba6ba 100644
--- a/package.json
+++ b/package.json
@@ -47,6 +47,7 @@
"stylus": "0.49.*",
"nib": "1.0.*",
"handlebars": "2.0.0-alpha.1",
+ "jade": "1.8.*",
"velocityjs": "0.4.x",
"tiny-lr": "0.0.7",
"gaze": "0.5.1",
diff --git a/src/compiler/plugins/jade.coffee b/src/compiler/plugins/jade.coffee
new file mode 100644
index 0000000..4bd1883
--- /dev/null
+++ b/src/compiler/plugins/jade.coffee
@@ -0,0 +1,26 @@
+syspath = require 'path'
+jade = require 'jade'
+
+
+exports.contentType = 'javascript'
+
+exports.process = (txt, path, module, cb)->
+ try
+ # console.log arguments
+ name = syspath.basename path, '.jade'
+ txt = jade.compileClient txt,
+ name: ' '
+ filename: path
+ doctype: 'html'
+
+ builded = """
+ if (typeof window.QTMPL === "undefined") window.QTMPL = {};
+ window.QTMPL["#{name}"] = #{txt};
+ if (typeof module !== "undefined") module.exports = window.QTMPL["#{name}"];
+ """
+
+ cb null, builded
+ catch e
+ cb e
+
+
\ No newline at end of file
diff --git a/testcase/modular/case/fekit.config b/testcase/modular/case/fekit.config
index 42b4f32..bced044 100644
--- a/testcase/modular/case/fekit.config
+++ b/testcase/modular/case/fekit.config
@@ -10,6 +10,10 @@
"scripts/page-a.js" ,
{ "path" : "scripts/page-b.js" , "parents" : [ "scripts/page-a.js" ] } ,
- { "path" : "scripts/page-c.js" , "no_version" : true }
- ]
+ { "path" : "scripts/page-c.js" , "no_version" : true },
+ "scripts/page-d.js"
+ ],
+ "dependencies": {
+ "jade-web": "1.0.1"
+ }
}
\ No newline at end of file
diff --git a/testcase/modular/case/fekit_modules/jade-web/README.md b/testcase/modular/case/fekit_modules/jade-web/README.md
new file mode 100644
index 0000000..5ea3177
--- /dev/null
+++ b/testcase/modular/case/fekit_modules/jade-web/README.md
@@ -0,0 +1,15 @@
+Jade Template Engine
+====================
+
+Jade Template Engine Web Browser runtime
+
+## Jade 模板引擎
+
+
+
+
+## fekit
+
+
+
+
diff --git a/testcase/modular/case/fekit_modules/jade-web/fekit.config b/testcase/modular/case/fekit_modules/jade-web/fekit.config
new file mode 100644
index 0000000..77b31f0
--- /dev/null
+++ b/testcase/modular/case/fekit_modules/jade-web/fekit.config
@@ -0,0 +1,12 @@
+{
+ "compiler": "component",
+ "name": "jade-web",
+ "version": "1.0.1",
+ "author" : "shawn.cao",
+ "email" : "shawn.cao@qunar.com",
+ "description" : "Jade Template Engine Web Browser runtime",
+ "repository":"https://github.com/netwjx/jade-web.git",
+ "dependencies": {},
+ "alias": {},
+ "export": []
+}
\ No newline at end of file
diff --git a/testcase/modular/case/fekit_modules/jade-web/src/index.js b/testcase/modular/case/fekit_modules/jade-web/src/index.js
new file mode 100644
index 0000000..5538db4
--- /dev/null
+++ b/testcase/modular/case/fekit_modules/jade-web/src/index.js
@@ -0,0 +1 @@
+this.jade = require('./runtime.js');
\ No newline at end of file
diff --git a/testcase/modular/case/fekit_modules/jade-web/src/runtime.js b/testcase/modular/case/fekit_modules/jade-web/src/runtime.js
new file mode 100644
index 0000000..f988514
--- /dev/null
+++ b/testcase/modular/case/fekit_modules/jade-web/src/runtime.js
@@ -0,0 +1,238 @@
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jade=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o} escaped
+ * @return {String}
+ */
+exports.cls = function cls(classes, escaped) {
+ var buf = [];
+ for (var i = 0; i < classes.length; i++) {
+ if (escaped && escaped[i]) {
+ buf.push(exports.escape(joinClasses([classes[i]])));
+ } else {
+ buf.push(joinClasses(classes[i]));
+ }
+ }
+ var text = joinClasses(buf);
+ if (text.length) {
+ return ' class="' + text + '"';
+ } else {
+ return '';
+ }
+};
+
+
+exports.style = function (val) {
+ if (val && typeof val === 'object') {
+ return Object.keys(val).map(function (style) {
+ return style + ':' + val[style];
+ }).join(';');
+ } else {
+ return val;
+ }
+};
+/**
+ * Render the given attribute.
+ *
+ * @param {String} key
+ * @param {String} val
+ * @param {Boolean} escaped
+ * @param {Boolean} terse
+ * @return {String}
+ */
+exports.attr = function attr(key, val, escaped, terse) {
+ if (key === 'style') {
+ val = exports.style(val);
+ }
+ if ('boolean' == typeof val || null == val) {
+ if (val) {
+ return ' ' + (terse ? key : key + '="' + key + '"');
+ } else {
+ return '';
+ }
+ } else if (0 == key.indexOf('data') && 'string' != typeof val) {
+ if (JSON.stringify(val).indexOf('&') !== -1) {
+ console.warn('Since Jade 2.0.0, ampersands (`&`) in data attributes ' +
+ 'will be escaped to `&`');
+ };
+ if (val && typeof val.toISOString === 'function') {
+ console.warn('Jade will eliminate the double quotes around dates in ' +
+ 'ISO form after 2.0.0');
+ }
+ return ' ' + key + "='" + JSON.stringify(val).replace(/'/g, ''') + "'";
+ } else if (escaped) {
+ if (val && typeof val.toISOString === 'function') {
+ console.warn('Jade will stringify dates in ISO form after 2.0.0');
+ }
+ return ' ' + key + '="' + exports.escape(val) + '"';
+ } else {
+ if (val && typeof val.toISOString === 'function') {
+ console.warn('Jade will stringify dates in ISO form after 2.0.0');
+ }
+ return ' ' + key + '="' + val + '"';
+ }
+};
+
+/**
+ * Render the given attributes object.
+ *
+ * @param {Object} obj
+ * @param {Object} escaped
+ * @return {String}
+ */
+exports.attrs = function attrs(obj, terse){
+ var buf = [];
+
+ var keys = Object.keys(obj);
+
+ if (keys.length) {
+ for (var i = 0; i < keys.length; ++i) {
+ var key = keys[i]
+ , val = obj[key];
+
+ if ('class' == key) {
+ if (val = joinClasses(val)) {
+ buf.push(' ' + key + '="' + val + '"');
+ }
+ } else {
+ buf.push(exports.attr(key, val, false, terse));
+ }
+ }
+ }
+
+ return buf.join('');
+};
+
+/**
+ * Escape the given string of `html`.
+ *
+ * @param {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function escape(html){
+ var result = String(html)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+ if (result === '' + html) return html;
+ else return result;
+};
+
+/**
+ * Re-throw the given `err` in context to the
+ * the jade in `filename` at the given `lineno`.
+ *
+ * @param {Error} err
+ * @param {String} filename
+ * @param {String} lineno
+ * @api private
+ */
+
+exports.rethrow = function rethrow(err, filename, lineno, str){
+ if (!(err instanceof Error)) throw err;
+ if ((typeof window != 'undefined' || !filename) && !str) {
+ err.message += ' on line ' + lineno;
+ throw err;
+ }
+ try {
+ str = str
+ } catch (ex) {
+ rethrow(err, null, lineno)
+ }
+ var context = 3
+ , lines = str.split('\n')
+ , start = Math.max(lineno - context, 0)
+ , end = Math.min(lines.length, lineno + context);
+
+ // Error context
+ var context = lines.slice(start, end).map(function(line, i){
+ var curr = i + start + 1;
+ return (curr == lineno ? ' > ' : ' ')
+ + curr
+ + '| '
+ + line;
+ }).join('\n');
+
+ // Alter exception message
+ err.path = filename;
+ err.message = (filename || 'Jade') + ':' + lineno
+ + '\n' + context + '\n\n' + err.message;
+ throw err;
+};
+
+},{"fs":2}],2:[function(require,module,exports){
+
+},{}]},{},[1])(1)
+});
\ No newline at end of file
diff --git a/testcase/modular/case/src/scripts/page-d.js b/testcase/modular/case/src/scripts/page-d.js
new file mode 100644
index 0000000..03d23c3
--- /dev/null
+++ b/testcase/modular/case/src/scripts/page-d.js
@@ -0,0 +1,8 @@
+require("jade-web")
+
+var d = require("./pageD.jade");
+
+console.info(d({
+ pageTitle: "hello world",
+ youAreUsingJade: false
+}));
\ No newline at end of file
diff --git a/testcase/modular/case/src/scripts/pageD.jade b/testcase/modular/case/src/scripts/pageD.jade
new file mode 100644
index 0000000..a0dd31f
--- /dev/null
+++ b/testcase/modular/case/src/scripts/pageD.jade
@@ -0,0 +1,20 @@
+doctype html
+html(lang="en")
+ head
+ title= pageTitle
+ script(type='text/javascript').
+ if (foo) {
+ bar(1 + 5)
+ }
+ body
+ h1 Jade - node template engine
+ #container.col
+ if youAreUsingJade
+ p You are amazing
+ else
+ p Get on it!
+ p.
+ Jade is a terse and simple
+ templating language with a
+ strong focus on performance
+ and powerful features.
\ No newline at end of file