Logo
Explore Help
Sign In
gaspersic/freeCodeCamp
1
0
Fork 0
You've already forked freeCodeCamp
Code Issues Pull Requests Projects Releases Wiki Activity
Files
64b63d73db4d6a871a0a769817ad616cd6cc0fb6
freeCodeCamp/server/middlewares/revision-helpers.js

14 lines
304 B
JavaScript
Raw Normal View History

add revisioning to js/css files to break caching This moves the location of javascript files, commonFramework, iFrameScript, sandbox, plugin, and all the less files. On gulp or gulp build these files are moved and revisioned. Places where they are references in jade/html are now removed and replaced with the use of a helper function `rev`. This function will take the required file and return a string referencing the revisioned file. This should alleviate the need for hard refreshing and will break caches when files change, so fixes for firefox caching issue as well. NOTE: @benmcmahon @quincylarson, This means files will need to be build on the server in production before doing a server restart/reload In production: 'npm run build' To build and revision js/css files `gulp` and `gulp build` will used in development npm install also needs to be run in production on initial deploy
2015-08-26 23:20:56 -07:00
import manifest from '../rev-manifest.json';
export default function({ globalPrepend = '' } = {}) {
function rev(scopedPrepend, asset) {
return `${globalPrepend}${scopedPrepend}/${ manifest[asset] || asset }`;
}
return function(req, res, next) {
res.locals.rev = rev;
next();
};
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.4 Page: 87ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API