Skip to content

Instantly share code, notes, and snippets.

@joeyhoer
Last active August 29, 2015 13:56
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 joeyhoer/9051031 to your computer and use it in GitHub Desktop.
Save joeyhoer/9051031 to your computer and use it in GitHub Desktop.
Browser Sync Gruntfile
module.exports = function(grunt) {
grunt.initConfig({
// Project Configuration
pkg: grunt.file.readJSON("package.json"),
sass: {
dist: {
options: {
style: 'compressed',
sourcemap: true,
quiet: true
},
files: [{
expand: true,
cwd: 'skin/frontend/folder/scss',
src: ['*.scss'],
dest: 'skin/frontend/folder/css',
ext: '.css'
}]
}
},
watch: {
build: {
files: [
'skin/frontend/folder/scss/*.scss',
'skin/frontend/folder/scss/**/*.scss'
],
tasks: ['sass'],
options: {
// spawn: false,
},
},
css: {
files: 'skin/frontend/folder/css/style.css',
tasks: ['notify:sass'],
options: {
livereload: true,
// spawn: false,
},
},
all: {
files: [
'app/design/frontend/folder/**/*.phtml',
'app/design/frontend/folder/**/*.xml'
],
options: {
livereload: true,
// spawn: false,
},
}
},
notify: {
sass: {
options: {
title: "<%= pkg.name %>",
message: "SCSS Changed\nCSS files have been recompiled",
},
},
},
browser_sync: {
dev: {
bsFiles: {
src : [
'skin/frontend/folder/css/**/*.css',
'skin/frontend/folder/images/*.jpg',
'skin/frontend/folder/images/*.png',
'skin/frontend/folder/js/**/*.js',
'app/design/frontend/folder/**/*.phtml',
'app/design/frontend/folder/**/*.xml'
]
//'skin/frontend/folder/css/style.css'
},
options: {
watchTask: true,
proxy: {
// Your existing vhost setup
host: "test.dev"
},
}
}
},
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.registerTask('default', ['sass', 'watch']);
grunt.registerTask('bsync', ['sass', 'browser_sync', 'watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment