Skip to content

Updates & Fixes #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _src/_includes/analytics.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script>
!function(s,y,n,c,I,t){s.GoogleAnalyticsObject=c,s[c]||(s[c]=function(){
(s[c].q=s[c].q||[]).push(arguments)}),s[c].l=+new Date,I=y.createElement(n),
t=y.getElementsByTagName(n)[0],I.src="//www.google-analytics.com/analytics.js",
t.parentNode.insertBefore(I,t)}(window,document,"script","ga");
t=y.getElementsByTagName(n)[0],I.src='//www.google-analytics.com/analytics.js',
t.parentNode.insertBefore(I,t)}(window,document,'script','ga');
// Nope
ga('create', 'UA-48819865-1', 'browsersync.io');
ga('send', 'pageview');
Expand Down
2 changes: 1 addition & 1 deletion _src/_includes/docs-nav.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
{{/each}}
</ul>
</div>
</div>
</div>
1 change: 0 additions & 1 deletion _src/_includes/header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@
</nav>
</div>
</header><!-- .end .site-header -->

2 changes: 1 addition & 1 deletion _src/_includes/home-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ <h1 class="site-title">Browsersync</h1>
</ul>

</div>
</header><!-- .end .site-header -->
</header><!-- .end .site-header -->
4 changes: 2 additions & 2 deletions _src/_includes/snippets/api/active.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var bs = require("browser-sync").create();
var bs = require('browser-sync').create();

// -> false as .init has not yet been called
console.log(bs.active);
Expand All @@ -7,4 +7,4 @@ bs.init(config, function (err, bs) {

// -> now true since BS is running now
console.log(bs.active);
});
});
8 changes: 4 additions & 4 deletions _src/_includes/snippets/api/browserSync.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// create an instance
var bs = require("browser-sync").create();
var bs = require('browser-sync').create();

// with config
bs.init({
server: {
baseDir: "./"
baseDir: './'
}
});

// with config + callback
bs.init(config, function (err, bs) {
if (!err) {
console.log("Browsersync is ready!");
console.log('Browsersync is ready!');
}
});
});
8 changes: 4 additions & 4 deletions _src/_includes/snippets/api/create.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// create an unnamed instance
var bs = require("browser-sync").create();
var bs = require('browser-sync').create();

// create a named instance
var bs = require("browser-sync").create('My server');
var bs = require('browser-sync').create('My server');


// create multiple
var bs1 = require("browser-sync").create('Server 1');
var bs2 = require("browser-sync").create('Server 2');
var bs1 = require('browser-sync').create('Server 1');
var bs2 = require('browser-sync').create('Server 2');
8 changes: 4 additions & 4 deletions _src/_includes/snippets/api/emitter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var bs = require("browser-sync").create();
var bs = require('browser-sync').create();

// Listen for the `init` event
bs.emitter.on("init", function () {
console.log("Browsersync is running!");
bs.emitter.on('init', function () {
console.log('Browsersync is running!');
});

bs.init(config);
bs.init(config);
4 changes: 2 additions & 2 deletions _src/_includes/snippets/api/exit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var bs = require("browser-sync").create();
var bs = require('browser-sync').create();

// Start the server
bs.init({server: "./app"});
bs.init({server: './app'});

// Quit the server after 5 seconds
setTimeout(function () {
Expand Down
4 changes: 2 additions & 2 deletions _src/_includes/snippets/api/get.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Create an named instance in one file...
var bs = require("browser-sync").create('My Server');
var bs = require('browser-sync').create('My Server');

// Start the Browsersync server
bs.init({
server: true
});

// now, retrieve the instance in another file...
var bs = require("browser-sync").get('My server');
var bs = require('browser-sync').get('My server');

// and call any methods on it.
bs.watch('*.html').on('change', bs.reload);
8 changes: 4 additions & 4 deletions _src/_includes/snippets/api/init.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var bs = require("browser-sync").create();
var bs = require('browser-sync').create();

// Start a Browsersync static file server
bs.init({
server: "./app"
server: './app'
});

// Start a Browsersync proxy
bs.init({
proxy: "http://www.bbc.co.uk"
});
proxy: 'http://www.bbc.co.uk'
});
4 changes: 2 additions & 2 deletions _src/_includes/snippets/api/init.options.proxy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var options = {
proxy: "mylocal.dev"
proxy: 'mylocal.dev'
};

browserSync(options);
browserSync(options);
4 changes: 2 additions & 2 deletions _src/_includes/snippets/api/init.options.server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var options = {
server: {
baseDir: "app"
baseDir: 'app'
},
port: 8000,
tunnel: true
};

browserSync(options);
browserSync(options);
8 changes: 4 additions & 4 deletions _src/_includes/snippets/api/notify.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var bs = require("browser-sync").create();
var bs = require('browser-sync').create();

// Text message
bs.notify("Compiling, please wait!");
bs.notify('Compiling, please wait!');

// HTML message
bs.notify("HTML <span color='green'>is supported</span> too!");
bs.notify('HTML <span color='green'>is supported</span> too!');

// Since 1.3.0, specify a timeout
bs.notify("This message will only last a second", 1000);
bs.notify('This message will only last a second', 1000);
6 changes: 3 additions & 3 deletions _src/_includes/snippets/api/reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
bs.reload();

// single file
bs.reload("styles.css");
bs.reload('styles.css');

// multiple files
bs.reload(["styles.css", "ie.css"]);
bs.reload(['styles.css', 'ie.css']);

// Since 2.6.0 - wildcards to reload ALL css files
bs.reload("*.css");
bs.reload('*.css');
2 changes: 1 addition & 1 deletion _src/_includes/snippets/api/require.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
var browserSync = require("browser-sync");
var browserSync = require('browser-sync');
2 changes: 1 addition & 1 deletion _src/_includes/snippets/api/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ gulp.task('less', function () {
return gulp.src('*.less')
.pipe(less())
.pipe(gulp.dest('css'))
.pipe(bs.stream({match: "**/*.css"}));
.pipe(bs.stream({match: '**/*.css'}));
});

14 changes: 7 additions & 7 deletions _src/_includes/snippets/api/watch.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Create a Browsersync instance
var bs = require("browser-sync").create();
var bs = require('browser-sync').create();

// Listen to change events on HTML and reload
bs.watch("*.html").on("change", bs.reload);
bs.watch('*.html').on('change', bs.reload);

// Provide a callback to capture ALL events to CSS
// files - then filter for 'change' and reload all
// css files on the page.
bs.watch("css/*.css", function (event, file) {
if (event === "change") {
bs.reload("*.css");
bs.watch('css/*.css', function (event, file) {
if (event === 'change') {
bs.reload('*.css');
}
});

// Now init the Browsersync server
bs.init({
server: "./app"
});
server: './app'
});
2 changes: 1 addition & 1 deletion _src/_includes/snippets/grunt/full.watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ module.exports = function (grunt) {

// define default task
grunt.registerTask('default', ['browserSync', 'watch']);
};
};
4 changes: 2 additions & 2 deletions _src/_includes/snippets/grunt/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ browserSync: {
src : 'assets/css/style.css'
},
options: {
proxy: "local.dev"
proxy: 'local.dev'
}
}
}
}
4 changes: 2 additions & 2 deletions _src/_includes/snippets/grunt/server.simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ browserSync: {
},
options: {
server: {
baseDir: "./"
baseDir: './'
}
}
}
}
4 changes: 2 additions & 2 deletions _src/_includes/snippets/gulp/reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ gulp.task('default', ['js'], function () {
// Serve files from the root of this project
browserSync.init({
server: {
baseDir: "./"
baseDir: './'
}
});

// add browserSync.reload to the tasks array to make
// all browsers reload after tasks are complete.
gulp.watch("js/*.js", ['js-watch']);
gulp.watch('js/*.js', ['js-watch']);
});
4 changes: 2 additions & 2 deletions _src/_includes/snippets/gulp/reload.manual.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ gulp.task('serve', function () {
// Serve files from the root of this project
browserSync.init({
server: {
baseDir: "./"
baseDir: './'
}
});

gulp.watch("*.html").on("change", reload);
gulp.watch('*.html').on('change', reload);
});
6 changes: 3 additions & 3 deletions _src/_includes/snippets/gulp/require.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var browserSync = require('browser-sync').create();
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: "./"
baseDir: './'
}
});
});
Expand All @@ -14,6 +14,6 @@ gulp.task('browser-sync', function() {

gulp.task('browser-sync', function() {
browserSync.init({
proxy: "yourlocal.dev"
proxy: 'yourlocal.dev'
});
});
});
10 changes: 5 additions & 5 deletions _src/_includes/snippets/gulp/sass.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ var sass = require('gulp-sass');
gulp.task('serve', ['sass'], function() {

browserSync.init({
server: "./app"
server: './app'
});

gulp.watch("app/scss/*.scss", ['sass']);
gulp.watch("app/*.html").on('change', browserSync.reload);
gulp.watch('app/scss/*.scss', ['sass']);
gulp.watch('app/*.html').on('change', browserSync.reload);
});

// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function() {
return gulp.src("app/scss/*.scss")
return gulp.src('app/scss/*.scss')
.pipe(sass())
.pipe(gulp.dest("app/css"))
.pipe(gulp.dest('app/css'))
.pipe(browserSync.stream());
});

Expand Down
12 changes: 6 additions & 6 deletions _src/_includes/snippets/gulp/sass.maps.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
var gulp = require("gulp");
var sass = require("gulp-ruby-sass");
var browserSync = require("browser-sync").create();
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var browserSync = require('browser-sync').create();

// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {

browserSync.init({
server: "./app"
server: './app'
});

gulp.watch("app/scss/*.scss", ['sass']);
gulp.watch("app/*.html").on('change', browserSync.reload);
gulp.watch('app/scss/*.scss', ['sass']);
gulp.watch('app/*.html').on('change', browserSync.reload);
});

/**
Expand Down
4 changes: 2 additions & 2 deletions _src/_includes/snippets/options/browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Open the site in Chrome
browser: "google chrome"
browser: 'google chrome'

// Open the site in Chrome & Firefox
browser: ["google chrome", "firefox"]
browser: ['google chrome', 'firefox']
2 changes: 1 addition & 1 deletion _src/_includes/snippets/options/excludedFileTypes.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Allow extra file-types to be used with Browsersync
excludedFileTypes: ["mp2"]
excludedFileTypes: ['mp2']
10 changes: 5 additions & 5 deletions _src/_includes/snippets/options/files.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
// single file
browserSync({
files: "app/css/style.css"
files: 'app/css/style.css'
});

// multiple files
browserSync({
files: ["app/css/style.css", "app/js/*.js"]
files: ['app/css/style.css', 'app/js/*.js']
});

// patterns + 1 with custom callback
// since 2.6.0
browserSync({
files: [
"wp-content/themes/**/*.css",
'wp-content/themes/**/*.css',
{
match: ["wp-content/themes/**/*.php"],
match: ['wp-content/themes/**/*.php'],
fn: function (event, file) {
/** Custom event handler **/
}
}
]
});
});
2 changes: 1 addition & 1 deletion _src/_includes/snippets/options/host.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Override host detection if you know the correct IP to use
host: "192.168.1.1"
host: '192.168.1.1'
Loading