From 4c02d0bea5ff7ce295d2a2f7ed005eac2c82706c Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Mon, 17 Feb 2014 14:01:30 +0000 Subject: chore(docs-assets): add versions to paths for imported assets This should prevent stale caches in browsers if we upgrade any of these assets. --- docs/docs.config.js | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'docs/docs.config.js') diff --git a/docs/docs.config.js b/docs/docs.config.js index cfd94a60..b93cae97 100644 --- a/docs/docs.config.js +++ b/docs/docs.config.js @@ -9,6 +9,12 @@ module.exports = function(config) { var version = gruntUtils.getVersion(); var cdnUrl = "//ajax.googleapis.com/ajax/libs/angularjs/" + version.cdn; + var getVersion = function(component, sourceFolder, packageFile) { + sourceFolder = sourceFolder || '../bower_components'; + packageFile = packageFile || 'bower.json'; + return require(path.join(sourceFolder,component,packageFile)).version; + }; + config = basePackage(config); @@ -38,20 +44,20 @@ module.exports = function(config) { '../angular-sanitize.js', '../angular-touch.js', '../angular-animate.js', - 'components/marked/lib/marked.js', + 'components/marked-' + getVersion('marked', '../node_modules', 'package.json') + '/lib/marked.js', 'js/angular-bootstrap/bootstrap.js', 'js/angular-bootstrap/bootstrap-prettify.js', 'js/angular-bootstrap/dropdown-toggle.js', - 'components/lunr.js/lunr.js', - 'components/google-code-prettify/src/prettify.js', - 'components/google-code-prettify/src/lang-css.js', + 'components/lunr.js-' + getVersion('lunr.js') + '/lunr.js', + 'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js', + 'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js', 'js/versions-data.js', 'js/pages-data.js', 'js/docs.js' ], stylesheets: [ - 'css/bootstrap/css/bootstrap.css', - 'components/open-sans-fontface/open-sans.css', + 'components/bootstrap-' + getVersion('bootstrap') + '/dist/css/bootstrap.css', + 'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css', 'css/prettify-theme.css', 'css/docs.css', 'css/animations.css' @@ -67,20 +73,20 @@ module.exports = function(config) { '../angular-sanitize.min.js', '../angular-touch.min.js', '../angular-animate.min.js', - 'components/marked/lib/marked.js', + 'components/marked-' + getVersion('marked', '../node_modules', 'package.json') + '/lib/marked.js', 'js/angular-bootstrap/bootstrap.js', 'js/angular-bootstrap/bootstrap-prettify.js', 'js/angular-bootstrap/dropdown-toggle.js', - 'components/lunr.js/lunr.min.js', - 'components/google-code-prettify/src/prettify.js', - 'components/google-code-prettify/src/lang-css.js', + 'components/lunr.js-' + getVersion('lunr.js') + '/lunr.min.js', + 'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js', + 'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js', 'js/versions-data.js', 'js/pages-data.js', 'js/docs.js' ], stylesheets: [ - 'components/bootstrap/dist/css/bootstrap.css', - 'components/open-sans-fontface/open-sans.css', + 'components/bootstrap-' + getVersion('bootstrap') + '/dist/css/bootstrap.min.css', + 'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css', 'css/prettify-theme.css', 'css/docs.css', 'css/animations.css' @@ -96,20 +102,20 @@ module.exports = function(config) { cdnUrl + '/angular-sanitize.min.js', cdnUrl + '/angular-touch.min.js', cdnUrl + '/angular-animate.min.js', - 'components/marked/lib/marked.js', + 'components/marked-' + getVersion('marked', '../node_modules', 'package.json') + '/lib/marked.js', 'js/angular-bootstrap/bootstrap.js', 'js/angular-bootstrap/bootstrap-prettify.js', 'js/angular-bootstrap/dropdown-toggle.js', - 'components/lunr.js/lunr.min.js', - 'components/google-code-prettify/src/prettify.js', - 'components/google-code-prettify/src/lang-css.js', + 'components/lunr.js-' + getVersion('lunr.js') + '/lunr.min.js', + 'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/prettify.js', + 'components/google-code-prettify-' + getVersion('google-code-prettify') + '/src/lang-css.js', 'js/versions-data.js', 'js/pages-data.js', 'js/docs.js' ], stylesheets: [ - 'components/bootstrap/dist/css/bootstrap.css', - 'components/open-sans-fontface/open-sans.css', + 'components/bootstrap-' + getVersion('bootstrap') + '/dist/css/bootstrap.min.css', + 'components/open-sans-fontface-' + getVersion('open-sans-fontface') + '/open-sans.css', 'css/prettify-theme.css', 'css/docs.css', 'css/animations.css' -- cgit v1.2.3