Skip to content

Instantly share code, notes, and snippets.

@mape
Created June 5, 2010 19:21
Show Gist options
  • Save mape/426918 to your computer and use it in GitHub Desktop.
Save mape/426918 to your computer and use it in GitHub Desktop.
// http://mape.me:8081/static/js/test.js
// http://mape.me:8081/static/css/test.css
var sys = require('sys');
var Connect = require('Connect/lib/connect');
var AssetsManager = require('./assetsManager');
new Connect.Server([
,{filter: 'log'}
,{filter: 'gzip'}
,{module: AssetsManager, groups: {
'base-js': {
//'debug': true,
'route': '/static/js/.*\.js'
,'path': './js/'
,'dataType': 'javascript'
,'files': [
'jquery.js'
,'jquery.ui.core.js'
,'jquery.json.js'
,'jquery.lint.js'
,'jquery.cookie.js'
],
'manipulate': function(fileContent)
{
return fileContent.replace(/\$(/g,'jQuery(');
}
},
'base-css': {
'route': '/static/css/.*\.css'
,'path': './css/'
,'dataType': 'css'
,'files': [
'reset.css'
,'project.css'
],
'manipulate': [
function(fileContent)
{
return fileContent.replace(/border-radius: *([^;]+)/g, 'border-radius: $1; -moz-border-radius: $1; -webkit-border-radius: $1;')
},
function(fileContent)
{
return fileContent.replace(/opacity: *([0-9]).?([0-9])?/g, 'opacity: $1.$2; -moz-opacity: $1.$2; filter:alpha(opacity=$20);')
}
]
}
}}
,{filter: 'error-handler'}
]).listen(8081);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment