mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fixed asset revving issue with css files
This commit is contained in:
@@ -19,11 +19,31 @@ module.exports = function(grunt) {
|
||||
'requirejs:build',
|
||||
'concat:js',
|
||||
'filerev',
|
||||
'remapFilerev',
|
||||
'usemin',
|
||||
'clean:temp',
|
||||
'uglify:dest'
|
||||
]);
|
||||
|
||||
|
||||
// task to add [[.AppSubUrl]] to reved path
|
||||
grunt.registerTask('remapFilerev', function(){
|
||||
var root = grunt.config().destDir;
|
||||
var summary = grunt.filerev.summary;
|
||||
var fixed = {};
|
||||
|
||||
for(var key in summary){
|
||||
if(summary.hasOwnProperty(key)){
|
||||
|
||||
var orig = key.replace(root, root+'/[[.AppSubUrl]]');
|
||||
var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]');
|
||||
fixed[orig] = revved;
|
||||
}
|
||||
}
|
||||
|
||||
grunt.filerev.summary = fixed;
|
||||
});
|
||||
|
||||
grunt.registerTask('build-post-process', function() {
|
||||
grunt.config('copy.dist_to_tmp', {
|
||||
expand: true,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
on_start: ['<%= destDir %>', '<%= tempDir %>'],
|
||||
temp: ['<%= tempDir %>'],
|
||||
docs: ['<%= docsDir %>']
|
||||
temp: ['<%= tempDir %>']
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,11 +1,29 @@
|
||||
module.exports = function(config) {
|
||||
module.exports = function() {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
html: [
|
||||
'<%= destDir %>/views/index.html',
|
||||
'<%= destDir %>/index.html',
|
||||
],
|
||||
options: {
|
||||
assetsDirs: ['<%= destDir %>']
|
||||
assetsDirs: ['<%= destDir %>'],
|
||||
patterns: {
|
||||
css: [
|
||||
[/(\.css)/, 'Replacing reference to image.png']
|
||||
]
|
||||
}
|
||||
// blockReplacements: {
|
||||
// css: function (block) {
|
||||
// console.log('aaaaaaaaaaaaa', block);
|
||||
// return '<link rel="stylesheet" href="aaaa' + block.dest + '">';
|
||||
// }
|
||||
// }
|
||||
// css: [
|
||||
// [/(grafana\.light\.min\.css)/, 'Replacing reference to light css', function(asd) {
|
||||
// console.log("Match", asd);
|
||||
// return 'css/grafana.light.min.css';
|
||||
// }]
|
||||
// ]
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@ module.exports = function(config) {
|
||||
return {
|
||||
html: [
|
||||
'tmp/index.html',
|
||||
'tmp/views/index.html',
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user