Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrated Hem codebase properly. Started working on defining and imp…
…lementing Weber config.
- Loading branch information
Showing
24 changed files
with
1,495 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ build = (callback) -> | |
callback?() if code is 0 | ||
|
||
task 'build', 'Build lib/ from src/', -> | ||
build() | ||
build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<% @identifier or= 'require' %> | ||
(function(/*! Stitch !*/) { | ||
if (!this.<%= @identifier %>) { | ||
var modules = {}, cache = {}, require = function(name, root) { | ||
var path = expand(root, name), indexPath = expand(path, './index'), module, fn; | ||
module = cache[path] || cache[indexPath] | ||
if (module) { | ||
return module; | ||
} else if (fn = modules[path] || modules[path = indexPath]) { | ||
module = {id: path, exports: {}}; | ||
cache[path] = module.exports; | ||
fn(module.exports, function(name) { | ||
return require(name, dirname(path)); | ||
}, module); | ||
return cache[path] = module.exports; | ||
} else { | ||
throw 'module ' + name + ' not found'; | ||
} | ||
}, expand = function(root, name) { | ||
var results = [], parts, part; | ||
if (/^\.\.?(\/|$)/.test(name)) { | ||
parts = [root, name].join('/').split('/'); | ||
} else { | ||
parts = name.split('/'); | ||
} | ||
for (var i = 0, length = parts.length; i < length; i++) { | ||
part = parts[i]; | ||
if (part == '..') { | ||
results.pop(); | ||
} else if (part != '.' && part != '') { | ||
results.push(part); | ||
} | ||
} | ||
return results.join('/'); | ||
}, dirname = function(path) { | ||
return path.split('/').slice(0, -1).join('/'); | ||
}; | ||
this.<%= @identifier %> = function(name) { | ||
return require(name, ''); | ||
} | ||
this.<%= @identifier %>.define = function(bundle) { | ||
for (var key in bundle) | ||
modules[key] = bundle[key]; | ||
}; | ||
this.<%= @identifier %>.modules = modules; | ||
this.<%= @identifier %>.cache = cache; | ||
} | ||
return this.<%= @identifier %>.define; | ||
}).call(this)({ | ||
<%- (JSON.stringify(module.id) + ": function(exports, require, module) {#{module.compile()}}" for module in @modules).join(', ') %> | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
(function() { | ||
var compilers, cs, dirname, eco, fs, stylus; | ||
|
||
fs = require('fs'); | ||
|
||
dirname = require('path').dirname; | ||
|
||
compilers = {}; | ||
|
||
compilers.js = compilers.css = function(path) { | ||
return fs.readFileSync(path, 'utf8'); | ||
}; | ||
|
||
require.extensions['.css'] = function(module, filename) { | ||
var source; | ||
source = JSON.stringify(compilers.css(filename)); | ||
return module._compile("module.exports = " + source, filename); | ||
}; | ||
|
||
try { | ||
cs = require('coffee-script'); | ||
compilers.coffee = function(path) { | ||
return cs.compile(fs.readFileSync(path, 'utf8'), { | ||
filename: path | ||
}); | ||
}; | ||
} catch (err) { | ||
|
||
} | ||
|
||
eco = require('eco'); | ||
|
||
compilers.eco = function(path) { | ||
var content; | ||
content = eco.precompile(fs.readFileSync(path, 'utf8')); | ||
return "module.exports = " + content; | ||
}; | ||
|
||
compilers.jeco = function(path) { | ||
var content; | ||
content = eco.precompile(fs.readFileSync(path, 'utf8')); | ||
return "module.exports = function(values){ \n var $ = jQuery, result = $();\n values = $.makeArray(values);\n \n for(var i=0; i < values.length; i++) {\n var value = values[i];\n var elem = $((" + content + ")(value));\n elem.data('item', value);\n $.merge(result, elem);\n }\n return result;\n};"; | ||
}; | ||
|
||
require.extensions['.jeco'] = require.extensions['.eco']; | ||
|
||
compilers.tmpl = function(path) { | ||
var content; | ||
content = fs.readFileSync(path, 'utf8'); | ||
return ("var template = jQuery.template(" + (JSON.stringify(content)) + ");\n") + "module.exports = (function(data){ return jQuery.tmpl(template, data); });\n"; | ||
}; | ||
|
||
require.extensions['.tmpl'] = function(module, filename) { | ||
return module._compile(compilers.tmpl(filename)); | ||
}; | ||
|
||
try { | ||
stylus = require('stylus'); | ||
compilers.styl = function(path) { | ||
var content, result; | ||
content = fs.readFileSync(path, 'utf8'); | ||
result = ''; | ||
stylus(content).include(dirname(path)).render(function(err, css) { | ||
if (err) throw err; | ||
return result = css; | ||
}); | ||
return result; | ||
}; | ||
require.extensions['.styl'] = function(module, filename) { | ||
var source; | ||
source = JSON.stringify(compilers.styl(filename)); | ||
return module._compile("module.exports = " + source, filename); | ||
}; | ||
} catch (err) { | ||
|
||
} | ||
|
||
module.exports = compilers; | ||
|
||
}).call(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
(function() { | ||
var CSS, compilers, resolve; | ||
|
||
resolve = require('path').resolve; | ||
|
||
compilers = require('./compilers'); | ||
|
||
CSS = (function() { | ||
|
||
function CSS(path) { | ||
try { | ||
this.path = require.resolve(resolve(path)); | ||
} catch (e) { | ||
|
||
} | ||
} | ||
|
||
CSS.prototype.compile = function() { | ||
if (!this.path) return; | ||
delete require.cache[this.path]; | ||
return require(this.path); | ||
}; | ||
|
||
CSS.prototype.createServer = function() { | ||
var _this = this; | ||
return function(env, callback) { | ||
return callback(200, { | ||
'Content-Type': 'text/css' | ||
}, _this.compile()); | ||
}; | ||
}; | ||
|
||
return CSS; | ||
|
||
})(); | ||
|
||
module.exports = { | ||
CSS: CSS, | ||
createPackage: function(path) { | ||
return new CSS(path); | ||
} | ||
}; | ||
|
||
}).call(this); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.