worked on css and js asset reving, and angular partial precaching, still need to fix panel module.html, issue #418

This commit is contained in:
Torkel Ödegaard 2014-06-01 16:57:59 +02:00
parent d499f4e0d0
commit f799ded434
9 changed files with 41 additions and 13 deletions

View File

@ -47,6 +47,7 @@ require.config({
elasticjs: '../vendor/elasticjs/elastic-angular-client',
'bootstrap-tagsinput': '../vendor/tagsinput/bootstrap-tagsinput',
},
shim: {
underscore: {

View File

@ -7,17 +7,20 @@
<meta name="viewport" content="width=device-width">
<title>Grafana</title>
<link rel="stylesheet" href="css/default.min.css" title="Light">
<!-- load the root require context -->
<link rel="stylesheet" href="css/default.min.css" title="Dark">
<!-- build:js app/app.js -->
<script src="vendor/require/require.js"></script>
<script src="app/components/require.config.js"></script>
<!-- endbuild -->
<script>require(['app'], function () {})</script>
</head>
<body ng-cloak body-class>
<link rel="stylesheet" ng-href="css/bootstrap.{{dashboard.current.style||'dark'}}.min.css">
<link rel="stylesheet" href="css/bootstrap.light.min.css" ng-if="dashboard.current.style === 'light'">
<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">

View File

@ -9,11 +9,13 @@ module.exports = function(grunt) {
'concat:css',
'copy:everything_but_less_to_temp',
'htmlmin:build',
'ngtemplates:app',
'ngtemplates',
'cssmin:build',
'ngmin:build',
'requirejs:build',
'concat:js',
'filerev',
'usemin',
'clean:temp',
'build:write_revision',
'uglify:dest'

View File

@ -10,5 +10,13 @@ module.exports = function(config) {
],
dest: '<%= srcDir %>/css/default.min.css'
},
js: {
src: [
'<%= destDir %>/vendor/require/require.js',
'<%= destDir %>/app/components/require.config.js',
'<%= destDir %>/app/app.js',
],
dest: '<%= destDir %>/app/app.js'
},
};
};

View File

@ -6,8 +6,12 @@ module.exports = function(config) {
length: 8,
},
css: {
src: '<%= srcDir %>/css/default.min.css',
src: '<%= destDir %>/css/default.min.css',
dest: '<%= destDir %>/css'
},
js: {
src: '<%= destDir %>/app/app.js',
dest: '<%= destDir %>/app'
}
};
};

View File

@ -8,7 +8,7 @@ module.exports = function(config) {
expand: true,
cwd: '<%= tempDir %>',
src: [
'index.html',
//'index.html',
'app/panels/**/*.html',
'app/partials/**/*.html'
],

View File

@ -1,9 +1,18 @@
module.exports = function(config) {
return {
kibana: {
grafana: {
cwd: '<%= tempDir %>',
src: 'app/**/*.html',
src: 'app/partials/**/*.html',
dest: '<%= tempDir %>/app/components/partials.js',
options: {
bootstrap: function(module, script) {
return "define('components/partials', ['angular'], function(angular) { \n" +
"angular.module('kibana').run(['$templateCache', function($templateCache) { \n" +
script +
'\n}]);' +
'\n});';
}
}
}
};
};

View File

@ -60,7 +60,10 @@ module.exports = function(config,grunt) {
'directives/all',
'jquery.flot.pie',
'angular-sanitize',
'angular-dragdrop'
'angular-dragdrop',
'panels/graphite/module',
'panels/text/module',
'panels/timepicker/module'
]
}
];
@ -75,7 +78,8 @@ module.exports = function(config,grunt) {
requireModules.push({
name: 'panels/'+panelName+'/'+subName+'/module',
exclude: ['app']
}); })
});
})
} else {
requireModules.push({
name: 'panels/'+panelName+'/module',

View File

@ -1,8 +1,5 @@
module.exports = function(config) {
return {
html: '<%= destDir %>/index.html',
options: {
assetsDirs: ['<%= destDir %>/css/']
}
};
};