Skip to content

Commit 7c5bb30

Browse files
author
Brian Muenzenmeyer
committed
Merge pull request #260 from pattern-lab/better-browsersync
Better browsersync configruation
2 parents 757142a + 75ff18a commit 7c5bb30

File tree

2 files changed

+51
-7
lines changed

2 files changed

+51
-7
lines changed

Gruntfile.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,36 @@ module.exports = function(grunt) {
101101
ignoreInitial: true,
102102
ignored: '*.html'
103103
},
104+
snippetOptions: {
105+
// Ignore all HTML files within the templates folder
106+
blacklist: ['/index.html', '/']
107+
},
104108
plugins: [
105109
{
106110
module: 'bs-html-injector',
107111
options: {
108112
files: [path.resolve(paths().public.root + '/index.html'), path.resolve(paths().public.styleguide + '/styleguide.html')]
109113
}
110114
}
111-
]
115+
],
116+
notify: {
117+
styles: [
118+
'display: none',
119+
'padding: 15px',
120+
'font-family: sans-serif',
121+
'position: fixed',
122+
'font-size: 1em',
123+
'z-index: 9999',
124+
'bottom: 0px',
125+
'right: 0px',
126+
'border-top-left-radius: 5px',
127+
'background-color: #1B2032',
128+
'opacity: 0.4',
129+
'margin: 0',
130+
'color: white',
131+
'text-align: center'
132+
]
133+
}
112134
}
113135
}
114136
},

gulpfile.js

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,39 @@ gulp.task('cp:css', function(){
9696
// Styleguide Copy
9797
gulp.task('cp:styleguide', function(){
9898
return gulp.src(
99-
[ '**/*'],
100-
{cwd: path.resolve(paths().source.styleguide)} )
99+
['**/*'],
100+
{cwd: path.resolve(paths().source.styleguide)})
101101
.pipe(gulp.dest(path.resolve(paths().public.styleguide)))
102-
.pipe(browserSync.stream());;
102+
.pipe(browserSync.stream());
103103
});
104104

105-
//server and watch tasks
106-
gulp.task('connect', ['lab'], function(){
105+
// server and watch tasks
106+
gulp.task('connect', ['lab'], function () {
107107
browserSync.init({
108108
server: {
109109
baseDir: path.resolve(paths().public.root)
110+
},
111+
snippetOptions: {
112+
// Ignore all HTML files within the templates folder
113+
blacklist: ['/index.html', '/']
114+
},
115+
notify: {
116+
styles: [
117+
'display: none',
118+
'padding: 15px',
119+
'font-family: sans-serif',
120+
'position: fixed',
121+
'font-size: 1em',
122+
'z-index: 9999',
123+
'bottom: 0px',
124+
'right: 0px',
125+
'border-top-left-radius: 5px',
126+
'background-color: #1B2032',
127+
'opacity: 0.4',
128+
'margin: 0',
129+
'color: white',
130+
'text-align: center'
131+
]
110132
}
111133
});
112134
gulp.watch(path.resolve(paths().source.css, '**/*.css'), ['cp:css']);
@@ -120,7 +142,7 @@ gulp.task('connect', ['lab'], function(){
120142
path.resolve(paths().source.data, '*.json'),
121143
path.resolve(paths().source.fonts + '/*'),
122144
path.resolve(paths().source.images + '/*'),
123-
path.resolve(paths().source.data + '*.json'),
145+
path.resolve(paths().source.data + '*.json')
124146
],
125147
['lab-pipe'],
126148
function () { browserSync.reload(); }

0 commit comments

Comments
 (0)