Created
April 21, 2016 20:03
-
-
Save Webbist-dev/2f11b287b401a37ea7c86c87fe71c890 to your computer and use it in GitHub Desktop.
Grunt + package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Why are you looking in here, dont you have some code to be writing | |
var serveStatic = require('serve-static'); | |
var path = require('path'); | |
var port = 35729; | |
module.exports = function( grunt ) { | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-connect'); | |
grunt.loadNpmTasks('grunt-open'); | |
grunt.initConfig({ | |
watch: { | |
livereload: { | |
files: [ | |
'{,*/}*.html', | |
'static/{,*/}*.{css,js,png,jpg,gif,svg}' | |
], | |
options: { | |
livereload: port | |
} | |
} | |
}, | |
connect: { | |
options: { | |
port: port, | |
hostname: '0.0.0.0' | |
}, | |
livereload: { | |
options: { | |
directory: 'build', | |
middleware: function(connect, options){ | |
var _staticPath = path.resolve(options.directory); | |
return [serveStatic(_staticPath)] | |
} | |
} | |
} | |
}, | |
open: { | |
server: { | |
url: 'http://localhost:<%= connect.options.port %>' | |
} | |
} | |
}); | |
grunt.registerTask('citd', function() { | |
grunt.task.run([ | |
'connect:livereload', | |
'open', | |
'watch' | |
]); | |
}); | |
grunt.registerTask('default', [ 'citd' ]); | |
}; | |
////////////////// | |
/// PACKAGE /// | |
////////////////// | |
{ | |
"name": "code-in-the-dark-competition", | |
"version": "1.0.0", | |
"description": "Code in the dark project files", | |
"main": "Gruntfile.js", | |
"scripts": { | |
"test": "Grunt" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "git+ssh://git@bitbucket.org/webbist/code-in-the-dark-competition.git" | |
}, | |
"author": "Alex Bennett", | |
"license": "ISC", | |
"homepage": "https://bitbucket.org/webbist/code-in-the-dark-competition#readme", | |
"devDependencies": { | |
"connect-livereload": "^0.5.4", | |
"grunt": "~0.4.0", | |
"grunt-contrib-connect": "^1.0.1", | |
"grunt-contrib-watch": "^1.0.0", | |
"grunt-express": "^1.4.1", | |
"grunt-open": "^0.2.3", | |
"matchdep": "^1.0.1", | |
"serve-static": "^1.10.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment