Commit 4f5534ed authored by JC Brand's avatar JC Brand

Finally fixed the non-AMD case to work with external templates.

parent c5ae10d9
module.exports = function(grunt) { module.exports = function(grunt) {
var cfg = require('./package.json'); var cfg = require('./package.json');
grunt.initConfig({ grunt.initConfig({
jst: {
compile: {
options: {
templateSettings: {
evaluate : /\{\[([\s\S]+?)\]\}/g,
interpolate : /\{\{([\s\S]+?)\}\}/g
},
processName: function (filepath) {
// E.g. src/templates/trimmed_chat.html
return filepath.match(/src\/templates\/([a-z_]+)\.html/)[1];
}
},
files: {
"builds/templates.js": ["src/templates/*.html"]
},
}
},
jshint: { jshint: {
options: { options: {
trailing: true trailing: true
...@@ -32,6 +51,7 @@ module.exports = function(grunt) { ...@@ -32,6 +51,7 @@ module.exports = function(grunt) {
}); });
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-jst');
grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.registerTask('test', 'Run Tests', function () { grunt.registerTask('test', 'Run Tests', function () {
...@@ -80,7 +100,8 @@ module.exports = function(grunt) { ...@@ -80,7 +100,8 @@ module.exports = function(grunt) {
}; };
exec('./node_modules/requirejs/bin/r.js -o src/build.js && ' + exec('./node_modules/requirejs/bin/r.js -o src/build.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ' + './node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-otr.js', callback); './node_modules/requirejs/bin/r.js -o src/build-no-otr.js &&' +
'./node_modules/requirejs/bin/r.js -o src/build-website.js', callback);
}); });
grunt.registerTask('minify', 'Create a new release', ['cssmin', 'jsmin']); grunt.registerTask('minify', 'Create a new release', ['cssmin', 'jsmin']);
......
...@@ -45,10 +45,10 @@ po2json: ...@@ -45,10 +45,10 @@ po2json:
######################################################################## ########################################################################
## Release management ## Release management
minjs: jsmin:
./node_modules/requirejs/bin/r.js -o src/build.js && ./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-website.js ./node_modules/requirejs/bin/r.js -o src/build.js && ./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-website.js
mincss: cssmin:
grunt cssmin grunt cssmin
release: release:
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -22,14 +22,7 @@ ...@@ -22,14 +22,7 @@
} }
); );
} else { } else {
// Browser globals root.converse = factory(jQuery, _, OTR, DSA, JST, moment);
// FIXME
_.templateSettings = {
evaluate : /\{\[([\s\S]+?)\]\}/g,
interpolate : /\{\{([\s\S]+?)\}\}/g
};
// TODO Templates not defined
root.converse = factory(jQuery, _, OTR, DSA, templates);
} }
}(this, function ($, _, OTR, DSA, templates, moment) { }(this, function ($, _, OTR, DSA, templates, moment) {
"use strict"; "use strict";
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<meta charset='utf-8' /> <meta charset='utf-8' />
<meta http-equiv="X-UA-Compatible" content="chrome=1" /> <meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="description" content="Converse.js: Open Source Browser-Based Instant Messaging" /> <meta name="description" content="Converse.js: Open Source Browser-Based Instant Messaging" />
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css"> <link type="text/css" rel="stylesheet" media="screen" href="css/theme.css" />
<link rel="stylesheet" type="text/css" media="screen" href="converse.css"> <link type="text/css" rel="stylesheet" media="screen" href="css/converse.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="components/otr/build/dep/salsa20.js"></script> <script type="text/javascript" src="components/otr/build/dep/salsa20.js"></script>
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
<!-- CryptoJS --> <!-- CryptoJS -->
<script type="text/javascript" src="components/otr/vendor/cryptojs/core.js"></script> <script type="text/javascript" src="components/otr/vendor/cryptojs/core.js"></script>
<script type="text/javascript" src="components/otr/vendor/cryptojs/enc-base64.js"></script> <script type="text/javascript" src="components/otr/vendor/cryptojs/enc-base64.js"></script>
<script type="text/javascript" src="components/crypto-js/src/md5.js"></script> <script type="text/javascript" src="components/crypto-js-evanvosberg/src/md5.js"></script>
<script type="text/javascript" src="components/crypto-js/src/evpkdf.js"></script> <script type="text/javascript" src="components/crypto-js-evanvosberg/src/evpkdf.js"></script>
<script type="text/javascript" src="components/otr/vendor/cryptojs/cipher-core.js"></script> <script type="text/javascript" src="components/otr/vendor/cryptojs/cipher-core.js"></script>
<script type="text/javascript" src="components/otr/vendor/cryptojs/aes.js"></script> <script type="text/javascript" src="components/otr/vendor/cryptojs/aes.js"></script>
<script type="text/javascript" src="components/otr/vendor/cryptojs/sha1.js"></script> <script type="text/javascript" src="components/otr/vendor/cryptojs/sha1.js"></script>
...@@ -32,16 +32,19 @@ ...@@ -32,16 +32,19 @@
<script type="text/javascript" src="components/strophe.disco/index.js"></script> <script type="text/javascript" src="components/strophe.disco/index.js"></script>
<script type="text/javascript" src="components/underscore/underscore.js"></script> <script type="text/javascript" src="components/underscore/underscore.js"></script>
<script type="text/javascript" src="components/backbone//backbone.js"></script> <script type="text/javascript" src="components/backbone//backbone.js"></script>
<script type="text/javascript" src="components/backbone.localStorage/backbone.localStorage.js"></script> <script type="text/javascript" src="components/backbone.browserStorage/backbone.browserStorage.js"></script>
<script type="text/javascript" src="components/backbone.overview/backbone.overview.js"></script>
<script type="text/javascript" src="components/momentjs/moment.js"></script>
<script type="text/javascript" src="components/jquery.browser/dist/jquery.browser.js"></script>
<script type="text/javascript" src="components/tinysort/src/jquery.tinysort.js"></script> <script type="text/javascript" src="components/tinysort/src/jquery.tinysort.js"></script>
<script type="text/javascript" src="components/jed/jed.js"></script> <script type="text/javascript" src="components/jed/jed.js"></script>
<script type="text/javascript" src="locale/en/LC_MESSAGES/en.js"></script> <script type="text/javascript" src="locale/en/LC_MESSAGES/en.js"></script>
<script type="text/javascript" src="builds/templates.js"></script>
<script type="text/javascript" src="converse.js"></script> <script type="text/javascript" src="converse.js"></script>
<title>Converse.js</title> <title>Converse.js</title>
</head> </head>
<body> <body>
<!-- HEADER --> <!-- HEADER -->
<div id="header_wrap" class="outer"> <div id="header_wrap" class="outer">
<header class="inner"> <header class="inner">
...@@ -192,7 +195,7 @@ ...@@ -192,7 +195,7 @@
converse.initialize({ converse.initialize({
auto_list_rooms: false, auto_list_rooms: false,
auto_subscribe: false, auto_subscribe: false,
bosh_service_url: 'https://bind.conversejs.org', // Please use this connection manager only for testing purposes bosh_service_url: 'http://devbox:8890/http-bind', // Please use this connection manager only for testing purposes
hide_muc_server: false, hide_muc_server: false,
i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported
prebind: false, prebind: false,
......
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
"grunt-contrib-requirejs": "~0.4.3", "grunt-contrib-requirejs": "~0.4.3",
"less": "~1.7.0", "less": "~1.7.0",
"phantom-jasmine": "0.1.8", "phantom-jasmine": "0.1.8",
"phantomjs": "~1.9.7-1" "phantomjs": "~1.9.7-1",
"grunt-contrib-jst": "~0.6.0"
}, },
"dependencies": { "dependencies": {
"requirejs": "~2.1.11" "requirejs": "~2.1.11"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment