Created
December 9, 2012 18:14
-
-
Save jonschlinkert/4246343 to your computer and use it in GitHub Desktop.
testing grunt-reload in the workflow
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
/*global module:false*/ | |
module.exports = function(grunt) { | |
'use strict'; | |
// Define bundles for each site | |
// Externalize to json all paths to src files for compressed bundles | |
var docsBundle = grunt.file.readJSON('build/bundles/docs.json'), | |
docsFiles = []; | |
var appBundle = grunt.file.readJSON('build/bundles/app.json'), | |
appFiles = []; | |
var websiteBundle = grunt.file.readJSON('build/bundles/website.json'), | |
websiteFiles = []; | |
// create flat arrays of all source files | |
(function processBundles() { | |
var i, len; | |
for(i = 0, len = docsBundle.length; i < len; i++) { | |
// append to flat array of all source files | |
docsFiles = docsFiles.concat(docsBundle[i].src); | |
} | |
for(i = 0, len = appBundle.length; i < len; i++) { | |
appFiles = appFiles.concat(appBundle[i].src); | |
} | |
for(i = 0, len = websiteBundle.length; i < len; i++) { | |
websiteFiles = websiteFiles.concat(websiteBundle[i].src); | |
} | |
})(); | |
// Project configuration | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
banner: '/**\n' + | |
'* <%= pkg.name %>.js v<%= pkg.version %> by @jonschlinkert and @doowb\n' + | |
'* Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' + | |
'*/', | |
jshint: { | |
all: [ | |
'Gruntfile.js', | |
'build/**/*.js', | |
'<%= nodeunit.tests %>' | |
], | |
options: { | |
jshintrc: 'build/.jshintrc' | |
} | |
}, | |
Reload browser when watch is triggered | |
reload: { | |
proxy: {} | |
}, | |
server: { | |
port: 8000, | |
base: '.' | |
}, | |
// Watch files and folders for changes | |
watch: { | |
reload: { | |
files: [ | |
'<config:watch.ui.files>' | |
], | |
tasks: "templates:components templates:docs less:dev recess" | |
} | |
} | |
}); | |
// Load npm plugins to provide necessary tasks. | |
grunt.loadNpmTasks('grunt-reload'); | |
// Load local tasks. | |
grunt.loadTasks('tasks'); | |
// Default task | |
grunt.registerTask('defaul', ['reload', 'server', 'watch:reload']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment