Add htaccess, make base configurable

This commit is contained in:
Vit Brunner
2014-11-11 21:05:19 +01:00
parent 3ebdaac320
commit 62a7ba76ce
3 changed files with 32 additions and 4 deletions
+27 -3
View File
@@ -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' ]
+4
View File
@@ -0,0 +1,4 @@
RewriteEngine On
RewriteBase <%= base %>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.html [PT]
+1 -1
View File
@@ -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")