Last active
September 17, 2020 16:42
-
-
Save qstudio/3c610c09333d1e70620e934a482ca074 to your computer and use it in GitHub Desktop.
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'; | |
module.exports = function(grunt) { | |
// run -- https://github.com/shama/grunt-hub ## | |
// grunt hub:all:watch | |
// OR | |
// npm run q:dev | |
// OR | |
// npm run q:deploy | |
grunt.initConfig({ | |
'config': { | |
'verbosity': { | |
'default': { | |
'options': { mode: 'oneline' }, // normal, oneline, dot, hidden | |
'tasks': [ 'deploy' ] | |
} | |
}, | |
'hub': { | |
'src': [ | |
'Gruntfile.js', // this ## | |
'wp-content/themes/q*/Gruntfile.js', // q* themes ## | |
'wp-content/plugins/q*/Gruntfile.js' // q* plugins ## | |
] | |
}, | |
'watch': { | |
// port for live reload ## | |
'livereload': 1337, | |
// scss files to watch ## | |
'scss': [ | |
'wp-content/themes/q*/**/*.scss', // regex to track all sass files in themes ## | |
'wp-content/plugins/q*/**/*.scss', // regex to track all sass files in plugins ## | |
], | |
// template files to watch ## | |
'template': [ | |
'wp-content/themes/q*/**/view/*.willow', // view [template] folder ## | |
'wp-content/plugin/q*/**/view/*.willow', // view [template] folder ## | |
], | |
// template files to watch ## | |
'js': [ | |
'wp-content/themes/q*/**/_source/**/*.js', // _source folder ## | |
'wp-content/plugin/q*/**/_source/**/*.js', // _source folder ## | |
], | |
} | |
}, | |
// end config ## | |
// grunt hub - master controller ## | |
hub: { | |
all: { | |
options: { | |
allowSelf: true, | |
}, | |
src: | |
'<%= config.hub.src %>' | |
, | |
tasks: [ 'default' ] | |
}, | |
}, | |
// watch task ## | |
'watch': { | |
// track changes to scss src files ## | |
'sass': { | |
'options': { | |
'livereload': '<%= config.watch.livereload %>', | |
'debounceDelay': 5000, | |
}, | |
'files': | |
'<%= config.watch.scss %>' | |
, | |
'tasks': [ | |
'log' // log activity ## | |
] | |
}, | |
// track changes to specific templates ## | |
'template': { | |
'options': { | |
'livereload': '<%= config.watch.livereload %>', | |
}, | |
'files': | |
'<%= config.watch.template %>' | |
, | |
'tasks': [ | |
'log' // log activity ## | |
] | |
}, | |
/* | |
// track changes to specific js files ## | |
'js': { | |
'options': { | |
'livereload': live_reload, | |
}, | |
'files': | |
'<%= watch_js %>' | |
, | |
'tasks': [ | |
'log' // log activity ## | |
] | |
}, | |
*/ | |
} | |
}); | |
// log ## | |
require('logfile-grunt')( grunt, { filePath: './wp-content/gruntfile.log', clearLogFile: true }); | |
// Load Tasks ## | |
grunt.loadNpmTasks( 'grunt-hub' ); // Global Grunt ## | |
grunt.loadNpmTasks( 'grunt-contrib-watch' ); // Watcher ## | |
// Development Tasks ## | |
grunt.registerTask( 'default', [ | |
'watch' // watch ## | |
]); | |
// Deploy Tasks ## | |
grunt.registerTask( 'deploy', [ | |
]); | |
// Log Tasks ## | |
grunt.registerTask( 'log', [ | |
]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment