Mercurial > wikked
changeset 103:cc1f3b81364c
Better development mode:
- Javascript files copied instead of being concatenated.
- They have cache busting enabled again.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 06 Nov 2013 22:14:19 -0800 |
parents | ea23c9483bc4 |
children | dfdfd092e250 |
files | Gruntfile.js wikked/settings.py wikked/templates/index-dev.html wikked/templates/index.html wikked/views.py |
diffstat | 5 files changed, 39 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/Gruntfile.js Tue Nov 05 08:13:53 2013 -0800 +++ b/Gruntfile.js Wed Nov 06 22:14:19 2013 -0800 @@ -50,9 +50,12 @@ } }, copy: { - images: { + development: { files: [ - {expand: true, cwd: 'static/', dest: 'build/', src: ['img/**']} + {expand: true, cwd: 'static/', dest: 'build/', src: ['img/**']}, + {expand: true, cwd: 'static/', dest: 'build/', src: ['js/**']}, + {expand: true, cwd: 'static/', dest: 'build/', src: ['tpl/**']}, + {expand: true, cwd: 'static/', dest: 'build/', src: ['bootstrap/js/*.js']} ] }, production: { @@ -96,9 +99,9 @@ grunt.loadNpmTasks('grunt-contrib-watch'); // Default task(s). - grunt.registerTask('default', ['less:production', 'requirejs:production', 'imagemin:all', 'copy:production']); + grunt.registerTask('default', ['jshint', 'less:production', 'requirejs:production', 'imagemin:all', 'copy:production']); // Other tasks. - grunt.registerTask('dev', ['less:development', 'requirejs:development', 'copy:production', 'copy:images']); + grunt.registerTask('dev', ['less:development', 'copy:production', 'copy:development']); };
--- a/wikked/settings.py Tue Nov 05 08:13:53 2013 -0800 +++ b/wikked/settings.py Wed Nov 06 22:14:19 2013 -0800 @@ -1,3 +1,4 @@ SECRET_KEY = '\xef)*\xbc\xd7\xa9t\x7f\xbc3pH1o\xc1\xe2\xb0\x19\\L\xeb\xe3\x00\xa3' DEBUG = True +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wikked/templates/index-dev.html Wed Nov 06 22:14:19 2013 -0800 @@ -0,0 +1,19 @@ +<!doctype html> +<html> + <head> + <title>Wikked</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link rel="stylesheet" type="text/css" href="/css/wikked.min.css" /> + </head> + <body> + <div id="app" class="container"> + </div> + <script type="text/javascript"> + var require = { + baseUrl: "/", + deps: ["/js/wikked.js{{cache_bust}}"] + }; + </script> + <script src="/js/require.js"></script> + </body> +</html>
--- a/wikked/templates/index.html Tue Nov 05 08:13:53 2013 -0800 +++ b/wikked/templates/index.html Wed Nov 06 22:14:19 2013 -0800 @@ -10,12 +10,5 @@ </div> <script src="/js/require.js"></script> <script src="/js/wikked.min.js"></script> - <!--script type="text/javascript"> - var require = { - baseUrl: "/", - deps: ["/js/wikked.js{{cache_bust}}"] - }; - </script> - <script src="/js/require.js"></script--> </body> </html>
--- a/wikked/views.py Tue Nov 05 08:13:53 2013 -0800 +++ b/wikked/views.py Wed Nov 06 22:14:19 2013 -0800 @@ -144,17 +144,26 @@ @app.route('/') def home(): - return render_template('index.html', cache_bust=('?%d' % time.time())) + tpl_name = 'index.html' + if app.config['DEBUG']: + tpl_name = 'index-dev.html' + return render_template(tpl_name, cache_bust=('?%d' % time.time())); @app.route('/read/<path:url>') def read(): - return render_template('index.html', cache_bust=('?%d' % time.time())) + tpl_name = 'index.html' + if app.config['DEBUG']: + tpl_name = 'index-dev.html' + return render_template(tpl_name, cache_bust=('?%d' % time.time())); @app.route('/search') def search(): - return render_template('index.html', cache_bust=('?%d' % time.time())) + tpl_name = 'index.html' + if app.config['DEBUG']: + tpl_name = 'index-dev.html' + return render_template(tpl_name, cache_bust=('?%d' % time.time())); @app.route('/api/list')