1
0
Fork 0
intro-to-vagrant/Gruntfile.coffee

163 lines
4 KiB
CoffeeScript
Raw Permalink Normal View History

2015-02-04 11:00:02 -05:00
# Generated on 2015-02-04 using generator-reveal 0.4.0
module.exports = (grunt) ->
grunt.initConfig
watch:
livereload:
options:
livereload: true
files: [
'index.html'
'slides/{,*/}*.{md,html}'
'js/*.js'
'css/*.css'
2015-05-13 11:30:26 -04:00
'img/*'
2015-02-04 11:00:02 -05:00
]
index:
files: [
'templates/_index.html'
'templates/_section.html'
'slides/list.json'
]
tasks: ['buildIndex']
coffeelint:
files: ['Gruntfile.coffee']
tasks: ['coffeelint']
jshint:
files: ['js/*.js']
tasks: ['jshint']
2015-05-13 11:30:26 -04:00
2015-02-04 11:00:02 -05:00
sass:
files: ['css/source/theme.scss']
tasks: ['sass']
sass:
theme:
files:
'css/theme.css': 'css/source/theme.scss'
2015-05-13 11:30:26 -04:00
2015-02-04 11:00:02 -05:00
connect:
livereload:
options:
port: 9000
# Change hostname to '0.0.0.0' to access
# the server from outside.
hostname: 'localhost'
base: '.'
open: true
livereload: true
coffeelint:
options:
indentation:
value: 4
max_line_length:
level: 'ignore'
all: ['Gruntfile.coffee']
jshint:
options:
jshintrc: '.jshintrc'
all: ['js/*.js']
copy:
dist:
files: [{
expand: true
src: [
'slides/**'
'bower_components/**'
'js/**'
'css/*.css'
2015-05-13 11:30:26 -04:00
'img/*'
2015-02-04 11:00:02 -05:00
]
dest: 'dist/'
},{
expand: true
src: ['index.html']
dest: 'dist/'
filter: 'isFile'
}]
2015-05-13 11:30:26 -04:00
buildcontrol:
options:
dir: 'dist'
commit: true
push: true
message: 'Built from %sourceCommit% on branch %sourceBranch%'
pages:
options:
remote: 'git@github.com:atomaka/intro-to-vagrant.git'
branch: 'gh-pages'
2015-02-04 11:00:02 -05:00
# Load all grunt tasks.
require('load-grunt-tasks')(grunt)
grunt.registerTask 'buildIndex',
'Build index.html from templates/_index.html and slides/list.json.',
->
indexTemplate = grunt.file.read 'templates/_index.html'
sectionTemplate = grunt.file.read 'templates/_section.html'
slides = grunt.file.readJSON 'slides/list.json'
html = grunt.template.process indexTemplate, data:
slides:
slides
section: (slide) ->
grunt.template.process sectionTemplate, data:
slide:
slide
grunt.file.write 'index.html', html
grunt.registerTask 'test',
'*Lint* javascript and coffee files.', [
'coffeelint'
'jshint'
]
grunt.registerTask 'serve',
'Run presentation locally and start watch process (living document).', [
'buildIndex'
'sass'
'connect:livereload'
'watch'
]
grunt.registerTask 'dist',
'Save presentation files to *dist* directory.', [
'test'
'sass'
'buildIndex'
'copy'
]
2015-05-13 11:30:26 -04:00
grunt.registerTask 'deploy',
'Deploy to Github Pages', [
'dist'
'buildcontrol'
]
2015-02-04 11:00:02 -05:00
# Define default task.
grunt.registerTask 'default', [
'test'
'serve'
]