Skip to content

Instantly share code, notes, and snippets.

@andrewmartin
Created April 7, 2014 05:24
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 andrewmartin/10015220 to your computer and use it in GitHub Desktop.
Save andrewmartin/10015220 to your computer and use it in GitHub Desktop.
gruntfile open
open = require('open')
fs = require('fs')
module.exports = (grunt) ->
grunt.initConfig
openFiles:
options:
filename: "index.html"
appName: "Firefox"
path: "./"
grunt.registerMultiTask 'openFiles', 'open', ->
options = @options()
basePath = @data.toString()
files = fs.readdirSync(basePath)
for i of files
continue unless files.hasOwnProperty(i)
name = basePath + files[i]
if fs.statSync(name).isDirectory()
open(name + "/" + options.filename, options.appName)
grunt.registerTask("default", "openFiles")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment