mirror of https://github.com/grafana/grafana.git
Fixed asset revving issue with css files
This commit is contained in:
parent
ab307ec7f3
commit
4b3224702c
|
|
@ -8,7 +8,6 @@ module.exports = function (grunt) {
|
||||||
srcDir: 'src',
|
srcDir: 'src',
|
||||||
destDir: 'dist',
|
destDir: 'dist',
|
||||||
tempDir: 'tmp',
|
tempDir: 'tmp',
|
||||||
docsDir: 'docs/',
|
|
||||||
arch: grunt.option('arch') || 'x86_64',
|
arch: grunt.option('arch') || 'x86_64',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ define([
|
||||||
function (Settings) {
|
function (Settings) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var bootData = window.grafanaBootData;
|
var bootData = window.grafanaBootData || { settings: {} };
|
||||||
var options = bootData.settings;
|
var options = bootData.settings;
|
||||||
|
|
||||||
return new Settings(options);
|
return new Settings(options);
|
||||||
|
|
|
||||||
|
|
@ -1,105 +0,0 @@
|
||||||
// == Configuration
|
|
||||||
// config.js is where you will find the core Grafana configuration. This file contains parameter that
|
|
||||||
// must be set before Grafana is run for the first time.
|
|
||||||
|
|
||||||
define(['settings'], function(Settings) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
return new Settings({
|
|
||||||
|
|
||||||
/* Data sources
|
|
||||||
* ========================================================
|
|
||||||
* Datasources are used to fetch metrics, annotations, and serve as dashboard storage
|
|
||||||
* - You can have multiple of the same type.
|
|
||||||
* - grafanaDB: true marks it for use for dashboard storage
|
|
||||||
* - default: true marks the datasource as the default metric source (if you have multiple)
|
|
||||||
* - basic authentication: use url syntax http://username:password@domain:port
|
|
||||||
*/
|
|
||||||
|
|
||||||
// InfluxDB example setup (the InfluxDB databases specified need to exist)
|
|
||||||
/*
|
|
||||||
datasources: {
|
|
||||||
influxdb: {
|
|
||||||
type: 'influxdb',
|
|
||||||
url: "http://my_influxdb_server:8086/db/database_name",
|
|
||||||
username: 'admin',
|
|
||||||
password: 'admin',
|
|
||||||
},
|
|
||||||
grafana: {
|
|
||||||
type: 'influxdb',
|
|
||||||
url: "http://my_influxdb_server:8086/db/grafana",
|
|
||||||
username: 'admin',
|
|
||||||
password: 'admin',
|
|
||||||
grafanaDB: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Graphite & Elasticsearch example setup
|
|
||||||
/*
|
|
||||||
datasources: {
|
|
||||||
graphite: {
|
|
||||||
type: 'graphite',
|
|
||||||
url: "http://my.graphite.server.com:8080",
|
|
||||||
},
|
|
||||||
elasticsearch: {
|
|
||||||
type: 'elasticsearch',
|
|
||||||
url: "http://my.elastic.server.com:9200",
|
|
||||||
index: 'grafana-dash',
|
|
||||||
grafanaDB: true,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
// OpenTSDB & Elasticsearch example setup
|
|
||||||
/*
|
|
||||||
datasources: {
|
|
||||||
opentsdb: {
|
|
||||||
type: 'opentsdb',
|
|
||||||
url: "http://opentsdb.server:4242",
|
|
||||||
},
|
|
||||||
elasticsearch: {
|
|
||||||
type: 'elasticsearch',
|
|
||||||
url: "http://my.elastic.server.com:9200",
|
|
||||||
index: 'grafana-dash',
|
|
||||||
grafanaDB: true,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Global configuration options
|
|
||||||
* ========================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
// specify the limit for dashboard search results
|
|
||||||
search: {
|
|
||||||
max_results: 100
|
|
||||||
},
|
|
||||||
|
|
||||||
// default home dashboard
|
|
||||||
default_route: 'dashboard/file/default.json',
|
|
||||||
|
|
||||||
// set to false to disable unsaved changes warning
|
|
||||||
unsaved_changes_warning: true,
|
|
||||||
|
|
||||||
// set the default timespan for the playlist feature
|
|
||||||
// Example: "1m", "1h"
|
|
||||||
playlist_timespan: "1m",
|
|
||||||
|
|
||||||
// Change window title prefix from 'Grafana - <dashboard title>'
|
|
||||||
window_title_prefix: 'Grafana - ',
|
|
||||||
|
|
||||||
// Add your own custom panels
|
|
||||||
plugins: {
|
|
||||||
// list of plugin panels
|
|
||||||
panels: [],
|
|
||||||
// requirejs modules in plugins folder that should be loaded
|
|
||||||
// for example custom datasources
|
|
||||||
dependencies: [],
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
|
|
||||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width">
|
|
||||||
<meta name="google" value="notranslate">
|
|
||||||
|
|
||||||
<title>Grafana</title>
|
|
||||||
<link rel="stylesheet" href="css/grafana.dark.min.css" title="Dark">
|
|
||||||
<link rel="icon" type="image/png" href="img/fav32.png">
|
|
||||||
|
|
||||||
<!-- build:js app/app.js -->
|
|
||||||
<script src="vendor/require/require.js"></script>
|
|
||||||
<script src="app/components/require.standalone.js"></script>
|
|
||||||
<!-- endbuild -->
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body ng-cloak ng-controller="GrafanaCtrl">
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/grafana.light.min.css" ng-if="grafana.style === 'light'">
|
|
||||||
|
|
||||||
<div class="page-alert-list">
|
|
||||||
<div ng-repeat='alert in dashAlerts.list' class="alert-{{alert.severity}} alert">
|
|
||||||
<button type="button" class="alert-close" ng-click="dashAlerts.clear(alert)">
|
|
||||||
<i class="fa fa-times-circle"></i>
|
|
||||||
</button>
|
|
||||||
<div class="alert-title">{{alert.title}}</div>
|
|
||||||
<div ng-bind-html='alert.text'></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div ng-view></div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
window.grafanaBackend = false;
|
|
||||||
window.grafanaBootData = {
|
|
||||||
user: {},
|
|
||||||
settings: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
require(['app'], function (app) {
|
|
||||||
app.boot();
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
@ -5,7 +5,7 @@ require.config({
|
||||||
specs: '../test/specs',
|
specs: '../test/specs',
|
||||||
mocks: '../test/mocks',
|
mocks: '../test/mocks',
|
||||||
helpers: '../test/specs/helpers',
|
helpers: '../test/specs/helpers',
|
||||||
config: ['../config', '../config.sample'],
|
config: 'components/config',
|
||||||
kbn: 'components/kbn',
|
kbn: 'components/kbn',
|
||||||
store: 'components/store',
|
store: 'components/store',
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
window.grafanaBackend = true;
|
window.grafanaBackend = true;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- build:js app/app.js -->
|
<!-- build:js [[.AppSubUrl]]/app/app.js -->
|
||||||
<script src="[[.AppSubUrl]]/public/vendor/require/require.js"></script>
|
<script src="[[.AppSubUrl]]/public/vendor/require/require.js"></script>
|
||||||
<script src="[[.AppSubUrl]]/public/app/components/require.config.js"></script>
|
<script src="[[.AppSubUrl]]/public/app/components/require.config.js"></script>
|
||||||
<!-- endbuild -->
|
<!-- endbuild -->
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,31 @@ module.exports = function(grunt) {
|
||||||
'requirejs:build',
|
'requirejs:build',
|
||||||
'concat:js',
|
'concat:js',
|
||||||
'filerev',
|
'filerev',
|
||||||
|
'remapFilerev',
|
||||||
'usemin',
|
'usemin',
|
||||||
'clean:temp',
|
'clean:temp',
|
||||||
'uglify:dest'
|
'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.registerTask('build-post-process', function() {
|
||||||
grunt.config('copy.dist_to_tmp', {
|
grunt.config('copy.dist_to_tmp', {
|
||||||
expand: true,
|
expand: true,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
module.exports = function(config) {
|
module.exports = function(config) {
|
||||||
return {
|
return {
|
||||||
on_start: ['<%= destDir %>', '<%= tempDir %>'],
|
on_start: ['<%= destDir %>', '<%= tempDir %>'],
|
||||||
temp: ['<%= tempDir %>'],
|
temp: ['<%= tempDir %>']
|
||||||
docs: ['<%= docsDir %>']
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,29 @@
|
||||||
module.exports = function(config) {
|
module.exports = function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
html: [
|
html: [
|
||||||
'<%= destDir %>/views/index.html',
|
'<%= destDir %>/views/index.html',
|
||||||
'<%= destDir %>/index.html',
|
|
||||||
],
|
],
|
||||||
options: {
|
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 {
|
return {
|
||||||
html: [
|
html: [
|
||||||
'tmp/index.html',
|
'tmp/index.html',
|
||||||
'tmp/views/index.html',
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue