Move script/style paths to Gruntfile

This commit is contained in:
Vit Brunner
2014-10-29 13:36:05 +01:00
parent 7f581aedf1
commit 7df7fa7cc4
4 changed files with 46 additions and 51 deletions
+40 -32
View File
@@ -1,18 +1,37 @@
module.exports = (grunt) ->
vars = {
scripts: [
'bower_components/lodash/dist/lodash.js'
'bower_components/angular/angular.js'
'bower_components/angular-route/angular-route.js'
'bower_components/angular-sanitize/angular-sanitize.js'
'bower_components/marked/lib/marked.js'
'scripts/app.js'
'scripts/services/fetch.js'
'scripts/services/poems.js'
'scripts/services/reader/_factory.js'
'scripts/services/reader/markdown.js'
'scripts/services/reader/json.js'
'scripts/services/transformer.js'
'scripts/controllers.js'
]
styles: [
'bower_components/fontawesome/css/font-awesome.min.css'
'bower_components/pure/pure-min.css'
'styles/style.css'
]
}
grunt.initConfig {
pkg: grunt.file.readJSON 'package.json'
var: {
source: 'source'
destination: 'build'
}
vars: vars
coffee: {
main: {
expand: true
cwd: '<%= var.source %>'
cwd: 'source'
src: '**/*.coffee'
dest: '<%= var.destination %>'
dest: 'build'
ext: '.js'
}
}
@@ -20,7 +39,7 @@ module.exports = (grunt) ->
connect: {
server: {
options: {
base: '<%= var.destination %>'
base: 'build'
}
}
}
@@ -28,20 +47,16 @@ module.exports = (grunt) ->
copy: {
main: {
expand: true
cwd: '<%= var.source %>'
cwd: 'source'
src: 'tests/the_raven/*'
dest: '<%= var.destination %>'
dest: 'build'
}
}
cssmin: {
main: {
files: {
'build/min/styles.css': [
'build/bower_components/fontawesome/css/font-awesome.min.css'
'build/bower_components/pure/pure-min.css'
'build/styles/**/*.css'
]
'build/min/styles.css': ('build/' + style for style in vars.styles)
}
}
}
@@ -49,10 +64,13 @@ module.exports = (grunt) ->
jade: {
main: {
expand: true
cwd: '<%= var.source %>'
cwd: 'source'
src: '**/*.jade'
dest: '<%= var.destination %>'
dest: 'build'
ext: '.html'
options: {
data: vars
}
}
}
@@ -67,9 +85,9 @@ module.exports = (grunt) ->
stylus: {
main: {
expand: true
cwd: '<%= var.source %>'
cwd: 'source'
src: '**/*.styl'
dest: '<%= var.destination %>'
dest: 'build'
ext: '.css'
}
}
@@ -77,28 +95,18 @@ module.exports = (grunt) ->
uglify: {
main: {
files: {
'build/min/scripts.js': [
'build/bower_components/lodash/dist/lodash.js'
'build/bower_components/angular/angular.js'
'build/bower_components/angular-route/angular-route.js'
'build/bower_components/angular-sanitize/angular-sanitize.js'
'build/bower_components/marked/lib/marked.js'
'build/scripts/**/*.js'
]
'build/min/scripts.js': ('build/' + script for script in vars.scripts)
}
}
}
watch: {
main: {
files: '<%= var.source %>/**/*'
files: 'source'
tasks: ['default', 'qunit']
}
min: {
files: [
'<%= var.destination %>/scripts/**/*.js'
'<%= var.destination %>/bower_components/**/*.js'
]
files: ('build/' + script for script in vars.scripts)
tasks: ['uglify']
}
}
-14
View File
@@ -1,14 +0,0 @@
// application scripts
script(src="bower_components/lodash/dist/lodash.js")
script(src="bower_components/angular/angular.js")
script(src="bower_components/angular-route/angular-route.js")
script(src="bower_components/angular-sanitize/angular-sanitize.js")
script(src="bower_components/marked/lib/marked.js")
script(src="scripts/app.js")
script(src="scripts/services/fetch.js")
script(src="scripts/services/poems.js")
script(src="scripts/services/reader/_factory.js")
script(src="scripts/services/reader/markdown.js")
script(src="scripts/services/reader/json.js")
script(src="scripts/services/transformer.js")
script(src="scripts/controllers.js")
+4 -4
View File
@@ -4,9 +4,9 @@ html(ng-app="sideBySide")
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")
link(rel="stylesheet", type="text/css", href="bower_components/fontawesome/css/font-awesome.min.css")
link(rel="stylesheet", type="text/css", href="bower_components/pure/pure-min.css")
link(rel="stylesheet", type="text/css", href="styles/style.css")
include includes/scripts.html.jade
for style in styles
link(rel="stylesheet", type="text/css", href="#{style}")
for script in scripts
script(src="#{script}")
include includes/body.html.jade
+2 -1
View File
@@ -4,7 +4,8 @@ html
title Side By Side test suite
meta(charset="utf-8")
include includes/scripts.html.jade
for script in scripts
script(src="#{script}")
// test scripts
link(rel="stylesheet", type="text/css", href="bower_components/qunit/qunit/qunit.css")