Added a cache busting config option to RequireJS that will add the latest commit sha to urls (only in dist build).
This commit is contained in:
+35
-12
@@ -102,21 +102,21 @@ module.exports = function (grunt) {
|
|||||||
options: {
|
options: {
|
||||||
appDir: '<%= tempDir %>',
|
appDir: '<%= tempDir %>',
|
||||||
dir: '<%= destDir %>',
|
dir: '<%= destDir %>',
|
||||||
modules: [], // populated below
|
|
||||||
mainConfigFile: '<%= tempDir %>/app/components/require.config.js',
|
mainConfigFile: '<%= tempDir %>/app/components/require.config.js',
|
||||||
keepBuildDir: true,
|
modules: [], // populated below
|
||||||
|
|
||||||
optimize: 'none',
|
optimize: 'none',
|
||||||
optimizeCss: 'none',
|
optimizeCss: 'none',
|
||||||
|
|
||||||
|
removeCombined: true,
|
||||||
preserveLicenseComments: false,
|
preserveLicenseComments: false,
|
||||||
findNestedDependencies: true,
|
findNestedDependencies: true,
|
||||||
normalizeDirDefines: "none",
|
normalizeDirDefines: "none",
|
||||||
inlineText: true,
|
inlineText: true,
|
||||||
skipPragmas: true,
|
skipPragmas: true,
|
||||||
optimizeAllPluginResources: false,
|
optimizeAllPluginResources: false,
|
||||||
removeCombined: true,
|
|
||||||
fileExclusionRegExp: /^\./,
|
|
||||||
logLevel: 0,
|
|
||||||
skipSemiColonInsertion: true,
|
|
||||||
done: function (done, output) {
|
done: function (done, output) {
|
||||||
var duplicates = require('rjs-build-analysis').duplicates(output);
|
var duplicates = require('rjs-build-analysis').duplicates(output);
|
||||||
|
|
||||||
@@ -127,11 +127,6 @@ module.exports = function (grunt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
done();
|
done();
|
||||||
},
|
|
||||||
config: {
|
|
||||||
'tmpl': {
|
|
||||||
registerTemplate: function () {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,9 +141,14 @@ module.exports = function (grunt) {
|
|||||||
quite: true,
|
quite: true,
|
||||||
compress: true,
|
compress: true,
|
||||||
preserveComments: false,
|
preserveComments: false,
|
||||||
banner: '<%= meta.banner %>',
|
banner: '<%= meta.banner %>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'git-describe': {
|
||||||
|
me: {
|
||||||
|
// Target-specific file lists and/or options go here.
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -201,10 +201,12 @@ module.exports = function (grunt) {
|
|||||||
grunt.loadNpmTasks('grunt-ngmin');
|
grunt.loadNpmTasks('grunt-ngmin');
|
||||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||||
grunt.loadNpmTasks('grunt-contrib-less');
|
grunt.loadNpmTasks('grunt-contrib-less');
|
||||||
|
grunt.loadNpmTasks('grunt-git-describe');
|
||||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
|
grunt.loadNpmTasks('grunt-string-replace');
|
||||||
grunt.loadNpmTasks('grunt-contrib-htmlmin');
|
grunt.loadNpmTasks('grunt-contrib-htmlmin');
|
||||||
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
grunt.loadNpmTasks('grunt-contrib-requirejs');
|
||||||
|
|
||||||
@@ -223,7 +225,28 @@ module.exports = function (grunt) {
|
|||||||
'ngmin',
|
'ngmin',
|
||||||
'requirejs:compile_temp',
|
'requirejs:compile_temp',
|
||||||
'clean:after_require',
|
'clean:after_require',
|
||||||
|
'write_revision_to_dest', // runs git-describe and replace:config
|
||||||
'uglify:dest'
|
'uglify:dest'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask('write_revision_to_dest', function() {
|
||||||
|
grunt.event.once('git-describe', function (desc) {
|
||||||
|
grunt.config('string-replace.config', {
|
||||||
|
src: '<%= destDir %>/app/components/require.config.js',
|
||||||
|
dest: '<%= destDir %>/app/components/require.config.js',
|
||||||
|
options: {
|
||||||
|
replacements: [
|
||||||
|
{
|
||||||
|
pattern: /(?:^|\/\/)(.*)@REV@/,
|
||||||
|
replacement: '$1'+desc.object
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.task.run('string-replace:config');
|
||||||
|
});
|
||||||
|
grunt.task.run('git-describe');
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
/*! kibana - v3.0.0m3pre - 2013-09-13
|
/*! kibana - v3.0.0m3pre - 2013-09-13
|
||||||
* Copyright (c) 2013 Rashid Khan; Licensed Apache License */
|
* Copyright (c) 2013 Rashid Khan; Licensed Apache License */
|
||||||
|
|
||||||
require.config({baseUrl:"app",paths:{config:"../config",settings:"components/settings",kbn:"components/kbn",css:"../vendor/require/css",text:"../vendor/require/text",moment:"../vendor/moment",filesaver:"../vendor/filesaver",angular:"../vendor/angular/angular","angular-strap":"../vendor/angular/angular-strap","angular-sanitize":"../vendor/angular/angular-sanitize",timepicker:"../vendor/angular/timepicker",datepicker:"../vendor/angular/datepicker",underscore:"components/underscore.extended","underscore-src":"../vendor/underscore",bootstrap:"../vendor/bootstrap/bootstrap",jquery:"components/jquery.extended","jquery-src":"../vendor/jquery/jquery-1.8.0","jquery.flot":"../vendor/jquery/jquery.flot","jquery.flot.pie":"../vendor/jquery/jquery.flot.pie","jquery.flot.selection":"../vendor/jquery/jquery.flot.selection","jquery.flot.stack":"../vendor/jquery/jquery.flot.stack","jquery.flot.time":"../vendor/jquery/jquery.flot.time",modernizr:"../vendor/modernizr-2.6.1",elasticjs:"../vendor/elasticjs/elastic-angular-client"},shim:{underscore:{exports:"_"},angular:{deps:["jquery"],exports:"angular"},bootstrap:{deps:["jquery"]},modernizr:{exports:"Modernizr"},"jquery-src":{exports:"jQuery"},"jquery.flot":["jquery"],"jquery.flot.pie":["jquery","jquery.flot"],"jquery.flot.selection":["jquery","jquery.flot"],"jquery.flot.stack":["jquery","jquery.flot"],"jquery.flot.time":["jquery","jquery.flot"],"angular-sanitize":["angular"],"angular-cookies":["angular"],"angular-loader":["angular"],"angular-mocks":["angular"],"angular-resource":["angular"],"angular-route":["angular"],"angular-touch":["angular"],"angular-strap":["angular","bootstrap","timepicker","datepicker"],timepicker:["jquery","bootstrap"],datepicker:["jquery","bootstrap"],elasticjs:["angular","../vendor/elasticjs/elastic"]}});
|
require.config({baseUrl:"app",urlArgs:"r=6c07338",paths:{config:"../config",settings:"components/settings",kbn:"components/kbn",css:"../vendor/require/css",text:"../vendor/require/text",moment:"../vendor/moment",filesaver:"../vendor/filesaver",angular:"../vendor/angular/angular","angular-strap":"../vendor/angular/angular-strap","angular-sanitize":"../vendor/angular/angular-sanitize",timepicker:"../vendor/angular/timepicker",datepicker:"../vendor/angular/datepicker",underscore:"components/underscore.extended","underscore-src":"../vendor/underscore",bootstrap:"../vendor/bootstrap/bootstrap",jquery:"components/jquery.extended","jquery-src":"../vendor/jquery/jquery-1.8.0","jquery.flot":"../vendor/jquery/jquery.flot","jquery.flot.pie":"../vendor/jquery/jquery.flot.pie","jquery.flot.selection":"../vendor/jquery/jquery.flot.selection","jquery.flot.stack":"../vendor/jquery/jquery.flot.stack","jquery.flot.time":"../vendor/jquery/jquery.flot.time",modernizr:"../vendor/modernizr-2.6.1",elasticjs:"../vendor/elasticjs/elastic-angular-client"},shim:{underscore:{exports:"_"},angular:{deps:["jquery"],exports:"angular"},bootstrap:{deps:["jquery"]},modernizr:{exports:"Modernizr"},"jquery-src":{exports:"jQuery"},"jquery.flot":["jquery"],"jquery.flot.pie":["jquery","jquery.flot"],"jquery.flot.selection":["jquery","jquery.flot"],"jquery.flot.stack":["jquery","jquery.flot"],"jquery.flot.time":["jquery","jquery.flot"],"angular-sanitize":["angular"],"angular-cookies":["angular"],"angular-loader":["angular"],"angular-mocks":["angular"],"angular-resource":["angular"],"angular-route":["angular"],"angular-touch":["angular"],"angular-strap":["angular","bootstrap","timepicker","datepicker"],timepicker:["jquery","bootstrap"],datepicker:["jquery","bootstrap"],elasticjs:["angular","../vendor/elasticjs/elastic"]}});
|
||||||
+3
-1
@@ -19,7 +19,9 @@
|
|||||||
"grunt-contrib-clean": "~0.5.0",
|
"grunt-contrib-clean": "~0.5.0",
|
||||||
"grunt-contrib-uglify": "~0.2.4",
|
"grunt-contrib-uglify": "~0.2.4",
|
||||||
"rjs-build-analysis": "0.0.3",
|
"rjs-build-analysis": "0.0.3",
|
||||||
"grunt-angular-templates": "~0.3.12"
|
"grunt-angular-templates": "~0.3.12",
|
||||||
|
"grunt-string-replace": "~0.2.4",
|
||||||
|
"grunt-git-describe": "~2.3.2"
|
||||||
},
|
},
|
||||||
"license": "Apache License"
|
"license": "Apache License"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
require.config({
|
require.config({
|
||||||
baseUrl: 'app',
|
baseUrl: 'app',
|
||||||
|
// urlArgs: 'r=@REV@',
|
||||||
paths: {
|
paths: {
|
||||||
config: '../config',
|
config: '../config',
|
||||||
settings: 'components/settings',
|
settings: 'components/settings',
|
||||||
@@ -36,12 +37,10 @@ require.config({
|
|||||||
},
|
},
|
||||||
shim: {
|
shim: {
|
||||||
underscore: {
|
underscore: {
|
||||||
// requiring should work, but isn't required
|
|
||||||
exports: '_'
|
exports: '_'
|
||||||
},
|
},
|
||||||
|
|
||||||
angular: {
|
angular: {
|
||||||
// requiring should work, but isn't required
|
|
||||||
deps: ['jquery'],
|
deps: ['jquery'],
|
||||||
exports: 'angular'
|
exports: 'angular'
|
||||||
},
|
},
|
||||||
@@ -55,11 +54,10 @@ require.config({
|
|||||||
},
|
},
|
||||||
|
|
||||||
'jquery-src': {
|
'jquery-src': {
|
||||||
// requiring should work, but isn't required
|
|
||||||
exports: 'jQuery'
|
exports: 'jQuery'
|
||||||
},
|
},
|
||||||
|
|
||||||
// simple dependency declatation
|
// simple dependency declaration
|
||||||
'jquery.flot': ['jquery'],
|
'jquery.flot': ['jquery'],
|
||||||
'jquery.flot.pie': ['jquery', 'jquery.flot'],
|
'jquery.flot.pie': ['jquery', 'jquery.flot'],
|
||||||
'jquery.flot.selection':['jquery', 'jquery.flot'],
|
'jquery.flot.selection':['jquery', 'jquery.flot'],
|
||||||
|
|||||||
Reference in New Issue
Block a user