Created
January 22, 2012 15:12
-
-
Save ryanrolds/1657328 to your computer and use it in GitHub Desktop.
connect-assetmanager cache busting
This file contains hidden or 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
var app = require('express').createServer(); | |
var assetManager = require('connect-assetmanager'); | |
var assetGroups = { | |
'jqueryGroup': { | |
'route': /\/static\/js\/jquery.js/, | |
'path': './public/js/', | |
'dataType': 'javascript', | |
'files': [ | |
'jquery.js', | |
'jquery.client.js' | |
] | |
} | |
} | |
var assets = assetManager(assetGroups); | |
app.configure(function(){ | |
assets, | |
app.use(app.router); | |
}); | |
app.get('/', function(req, res){ | |
res.render('someView', {'hash': assets.cacheHashes.jqueryGroup}); | |
}); | |
app.listen(3000); |
This file contains hidden or 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
<script type="text/javascript" src="/static/js/jquery.js?v={{hash}}"/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment