gulp-recipe-browsersync-server
v0.1.5
Published
Receipe for serving files with autoreload
Downloads
4
Maintainers
Readme
gulp-recipe-browsersync-server
Local development and distribution testing server with all browsersync features. Provides global watch handler.
Tasks
serve
deps: preServe
Run the whole development server stack, with browsersync with all its features as a server.
serve:dist
Serve files from dist folder. Note that project needs to be built manually first.
preServe
deps: watch
Run all preServe hooks.
watch
deps: clean:temp
Run all watch hooks.
clean:temp
Delete temp folder and its contents.
Configuration
Recipe specific
browserSync
default: {} type: object
Browsersync config options, shared between both dev and dist server.
browserSync.dev
default: {port: config.ports.dev, server: {baseDir: [config.paths.tmp, config.paths.app]}} type: object
Browsersync config options, specific for dev server. Merged with shared config.
browserSync.dist
default: {port: config.ports.dist, server: {baseDir: config.paths.dist}} type: object
Browsersync config options, specific for dist server. Merged with shared config.
browserSync.useHistoryApi
dev specific: browserSync.dev.useHistoryApi dist specific: browserSync.dist.useHistoryApi
Add history api handling middleware to selected environment.
Sources
sources.devAssets
mandatory
Files that will be watched for changes by browserSync. Typically should include all files that may be directly served.
example config:
sources.devAssets = [
paths.app + 'bower_components/*/*.js',
paths.app + 'bower_components/*/{dist,min,release}/*.{js,css}', // most of the generic bower modules
sources.js, // include only when serving non-processed js files
sources.css, // include only when serving non-processed css files
{ files: paths.tmp + '**/*', base: paths.tmp } // all processed files from temp directory
];
Paths
paths.dist
default: 'app/'
App folder path, part of default dev baseDir configuration.
paths.tmp
default: 'tmp/'
Temp folder path, part of default dev baseDir configuration.
paths.dist
default: 'dist/'
Dist folder path, part of default dist baseDir configuration.
Ports
ports.dev
default: 3000
Default port for browserSync server. Part of default dev port configuration. Note: actual used port may be different, as browserSync performs a empty port scan.
ports.dist
default: 3100
Default port for browserSync server. Part of default dev port configuration. Note: actual used port may be different, as browserSync performs a empty port scan.
Tasks
tasks.browserSyncServe
alias: tasks.serve default: 'watch'
serve task name.
tasks.browserSyncServeDist
alias: tasks.serveDist default: 'serve:dist'
serve:dist task name.
tasks.browserSyncPreServe
alias: tasks.preServe default: 'preServe'
preServe task name.
tasks.browserSyncWatch
alias: tasks.watch default: 'watch'
watch task name.
tasks.browserSyncCleanTemp
alias: tasks.cleanTemp default: 'clean:temp'
clean:temp task name.
Api
Provided Hooks
watch
Runs all hooked watch tasks before serve and preServe.
preServe
Runs all hooked preServe tasks just before server start, after watchers.
Used Hooks
pipes.devAsset*
Watch source files in devAsset pipes.