Skip to content

Instantly share code, notes, and snippets.

@kamiyam
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamiyam/b99ce2008af88d6c9afa to your computer and use it in GitHub Desktop.
Save kamiyam/b99ce2008af88d6c9afa to your computer and use it in GitHub Desktop.
Grunt - Middleman Cooperation
module.exports = (grunt)->
pkg = grunt.file.readJSON 'package.json'
for taskName of pkg.devDependencies
if taskName.substring(0,6) == 'grunt-'
grunt.loadNpmTasks taskName
grunt.initConfig
external_daemon:
mid_serve:
cmd: "bundle"
args: ["exec","middleman","server"]
options:
verbose: true
typescript:
base:
src: ['typescript_source/main.ts']
dest: 'source/javascripts/main.js'
options:
soureMap: true
middleman:
options:
useBundle: true
build:
options:
command: 'build'
watch:
options:
livereload: true
typescript:
files: ['typescript_source/*.ts']
tasks: ['typescript']
grunt.registerTask 'default', ['typescript','watch']
grunt.registerTask 'build', ['typescript', 'middleman:build']
grunt.registerTask 'serve', ['typescript','external_daemon:mid_serve','watch']
{
"name": "middleman_and_typescript",
"version": "0.0.0",
"description": "",
"main": "Grutnfile.coffee",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "k5m",
"license": "MIT",
"devDependencies": {
"grunt": "^0.4.4",
"grunt-contrib-watch": "^0.6.1",
"grunt-middleman": "^0.1.2",
"grunt-typescript": "^0.3.4",
"grunt-external-daemon": "^1.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment