diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 8e2d9bb..c4062ac 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -57,6 +57,10 @@ module.exports = (grunt) -> min: false } + template_data = { + base: '/' + } + watchconfigs = { main: { coffee: { @@ -126,12 +130,32 @@ module.exports = (grunt) -> } copy: { + main_htaccess: { + expand: true + cwd: 'source' + src: '.htaccess' + dest: 'build' + options: { + processContent: (content) -> + grunt.template.process content, { data: template_data } + } + } main_raven: { expand: true cwd: 'source' src: 'tests/the_raven/*' dest: 'build' } + min_htaccess: { + expand: true + cwd: 'source' + src: '.htaccess' + dest: 'build-min' + options: { + processContent: (content) -> + grunt.template.process content, { data: template_data } + } + } min_raven: { expand: true cwd: 'source' @@ -163,7 +187,7 @@ module.exports = (grunt) -> dest: 'build' ext: '.html' options: { - data: vars + data: _.extend {}, vars, template_data pretty: true } } @@ -174,7 +198,7 @@ module.exports = (grunt) -> dest: 'build-min' ext: '.html' options: { - data: _.extend {}, vars, { min: true } + data: _.extend {}, vars, template_data, { min: true } } } } @@ -222,7 +246,7 @@ module.exports = (grunt) -> grunt.loadNpmTasks('grunt-contrib-watch'); # Register tasks - grunt.registerTask 'default', [ 'coffee:main', 'copy:main_raven', 'jade:main', 'stylus:main' ] + grunt.registerTask 'default', [ 'coffee:main', 'copy:main_htaccess', 'copy:main_raven', 'jade:main', 'stylus:main' ] grunt.registerTask 'min', [ 'jade:min', 'copy:min_raven', 'copy:min_fonts', 'uglify:min', 'cssmin:min' ] grunt.registerTask 'test', [ 'default', 'min', 'connect', 'qunit' ] diff --git a/source/.htaccess b/source/.htaccess new file mode 100644 index 0000000..a37d144 --- /dev/null +++ b/source/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine On +RewriteBase <%= base %> +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule .* index.html [PT] diff --git a/source/index.html.jade b/source/index.html.jade index 829db9e..de052de 100644 --- a/source/index.html.jade +++ b/source/index.html.jade @@ -1,7 +1,7 @@ doctype html html(ng-app="sideBySide") head - base(href='/') + base(href="#{base}") title Side By Side viewer meta(charset="utf-8") link(rel="stylesheet", type="text/css", href="//fonts.googleapis.com/css?family=Noticia+Text:400,700,400italic,700italic")