Last active
December 7, 2019 18:30
-
-
Save joshmfrankel/a9ee530beada80646983 to your computer and use it in GitHub Desktop.
GRUNT: Basic setup for load-grunt-config
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
# Place your tasks inside /grunt folder | |
# | |
# Custom tasks still require the old syntax and should be | |
# placed inside their respective plugin config before the return statement | |
default: | |
- 'watch' |
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
module.exports = function(grunt) { | |
// Retrieve package settings | |
var config = { | |
pkg: grunt.file.readJSON('package.json'), | |
env: process.env, | |
dir: { | |
php : ['**/file1.php', 'file2.php'], | |
js : ['**/*.js'], | |
sass: ['**/*.scss'] | |
} | |
}; | |
// Load all plugins, tasks, and configs | |
require('load-grunt-config')(grunt, { | |
data: { | |
config: config | |
} | |
}); | |
}; |
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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
///////////////// | |
// Watch Tasks // | |
///////////////// | |
watch: { | |
compass: { | |
files: ['**/*.{scss,sass}'], | |
tasks: ['compass:dev', 'notify:compass'], | |
options: { | |
livereload: false, | |
} | |
}, | |
php: { | |
files: ['**/*.php', '!**/blog/*.php', '!**/wordpress/*.php'], | |
tasks: ['notify:livereload'], | |
options: { | |
livereload: true, | |
} | |
}, | |
js: { | |
files: ['resources/js/orbit_js/*.js'], | |
tasks: ['notify:livereload'], | |
options: { | |
livereload: true, | |
} | |
} | |
}, | |
///////////// | |
// Compass // | |
///////////// | |
compass: { | |
dev: { | |
options: { | |
sassDir: 'resources/sass', | |
cssDir: 'resources/css', | |
outputStyle: 'expanded', | |
noLineComments: false | |
} | |
}, | |
prod: { | |
options: { | |
sassDir: 'resources/sass', | |
cssDir: 'resources/css', | |
outputStyle: 'compressed', | |
noLineComments: true | |
} | |
} | |
}, | |
///////////////// | |
// BrowserSync // | |
///////////////// | |
browserSync: { | |
dev: { | |
bsFiles: { | |
src: ['resources/css/*.css', '**/*.php', 'resources/js/orbit_js/*.js'] | |
}, | |
options: { | |
proxy: 'http://bda.mighty-site.dev/', | |
open: 'external', | |
logConnections: true, | |
watchTask: true | |
} | |
} | |
}, | |
//////////// | |
// Notify // | |
//////////// | |
notify: { | |
compass: { | |
options: { | |
title: "Grunt - Compass", | |
message: "SASS compiled successful" | |
} | |
}, | |
livereload: { | |
options: { | |
title: "Grunt - Livereload", | |
message: "Reloading Browser..." | |
} | |
}, | |
init: { | |
options: { | |
title: "Grunt", | |
message: "Started" | |
} | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-browser-sync'); | |
grunt.loadNpmTasks('grunt-contrib-compass'); | |
grunt.loadNpmTasks('grunt-notify'); | |
grunt.registerTask('default',['notify:init', 'browserSync', 'watch']); | |
} |
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
module.exports = function (grunt) { | |
// Custom task with callback | |
// grunt.registerTask('console:welcome', function () { | |
// grunt.removeTaskName(); | |
// grunt.log.write(grunt.getWelcomeMessage()); | |
// }); | |
return { | |
sass: { | |
files: "<%= config.dir.sass %>", | |
options: { | |
livereload: true | |
}, | |
tasks: ['notify'] | |
}, | |
js: { | |
files: "<%= config.dir.js %>", | |
options: { | |
livereload: true | |
}, | |
tasks: ['notify'] | |
}, | |
php: { | |
files: "<%= config.dir.php %>", | |
options: { | |
livereload: true | |
}, | |
tasks: ['notify'] | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment