Client code in MOJO_MODE 'development' will no longer
rely on the prebuilds
Change-Id: I894853589180467b569b1b89aebe3953a5eac334
diff --git a/dev/js/src/app/devel.js b/dev/js/src/app/devel.js
new file mode 100644
index 0000000..73c6f75
--- /dev/null
+++ b/dev/js/src/app/devel.js
@@ -0,0 +1,15 @@
+/**
+ * This file defines the development environment
+ * of the application.
+ */
+
+requirejs.config({
+ baseUrl: 'js/src',
+ paths : {
+ 'lib': '../lib'
+ }
+});
+
+require(['app/en'], function (lang) {
+ // TODO: Define logging output!
+});
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index ad2b9c9..34cfadc 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -90,6 +90,11 @@
# Fix api endpoints
$self->config('Kalamar')->{api} = $mount_point;
$self->config('Search')->{api} = $mount_point;
+ }
+
+ # Add development path
+ elsif ($self->mode eq 'development') {
+ push @{$self->static->paths}, 'dev';
};
# Client notifications
diff --git a/templates/layouts/main.html.ep b/templates/layouts/main.html.ep
index de56fb0..d69e4d0 100644
--- a/templates/layouts/main.html.ep
+++ b/templates/layouts/main.html.ep
@@ -6,13 +6,18 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=false, user-scalable=no" />
<link href="<%= stash 'prefix' %>/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link href="<%= stash 'prefix' %>/css/kalamar-<%= $Kalamar::VERSION %>.css" type="text/css" rel="stylesheet" />
- %= javascript begin
+%= javascript begin
window.KorAP = window.KorAP || {};
% my $api = url_for('index');
% $api =~ s!/$!!;
KorAP.URL = '<%== $api %>';
% end
+
+% if ($c->app->mode eq 'development') {
+ <script data-main="js/src/app/devel" src="js/lib/require.js" async="async"></script>
+% } else {
<script src="<%= (stash('prefix') // '') . '/js/' . loc('jsFile', 'kalamar-' . $Kalamar::VERSION . '-en.js') %>" async="async"></script>
+% };
</head>
% my $embedded = 0;
% $embedded = 1 if stash('embedded');