default-config.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. /**
  2. * @module BrowserSync.options
  3. */
  4. module.exports = {
  5. /**
  6. * Browsersync includes a user-interface that is accessed via a separate port.
  7. * The UI allows to controls all devices, push sync updates and much more.
  8. * @property ui
  9. * @type Object
  10. * @param {Number} [port=3001]
  11. * @since 2.0.0
  12. * @default false
  13. */
  14. ui: {
  15. port: 3001
  16. },
  17. /**
  18. * Browsersync can watch your files as you work. Changes you make will either
  19. * be injected into the page (CSS & images) or will cause all browsers to do
  20. * a full-page refresh.
  21. * @property files
  22. * @type Array|String
  23. * @default false
  24. */
  25. files: false,
  26. /**
  27. * Specify which file events to respond to.
  28. * Available events: `add`, `change`, `unlink`, `addDir`, `unlinkDir`
  29. * @property watchEvents
  30. * @type Array
  31. * @default ["change"]
  32. * @since 2.18.8
  33. */
  34. watchEvents: ["change"],
  35. /**
  36. * Watch files automatically - this should be used as an
  37. * alternative to the `files` option. When this option is used, some directories
  38. * will be ignored automatically such as `node_modules` `bower_components` `.sass-cache`
  39. * `.vscode` `.git` `.idea`
  40. *
  41. * @property watch
  42. * @type Boolean
  43. * @default false
  44. * @since 2.23.0
  45. */
  46. watch: false,
  47. /**
  48. * Patterns for any watchers to ignore. Anything provided here
  49. * will end up inside `watchOptions.ignored`
  50. * @property ignore
  51. * @type Array
  52. * @default []
  53. * @since 2.23.0
  54. */
  55. ignore: [],
  56. /**
  57. * Serve an index.html file for all non-asset routes. Useful
  58. * when using client-routers
  59. * @property single
  60. * @type Boolean
  61. * @default false
  62. * @since 2.23.0
  63. */
  64. single: false,
  65. /**
  66. * File watching options that get passed along to [Chokidar](https://github.com/paulmillr/chokidar).
  67. * Check their docs for available options
  68. * @property watchOptions
  69. * @type Object
  70. * @default undefined
  71. * @since 2.6.0
  72. */
  73. watchOptions: {
  74. ignoreInitial: true
  75. /*
  76. persistent: true,
  77. ignored: '*.txt',
  78. followSymlinks: true,
  79. cwd: '.',
  80. usePolling: true,
  81. alwaysStat: false,
  82. depth: undefined,
  83. interval: 100,
  84. ignorePermissionErrors: false,
  85. atomic: true
  86. */
  87. },
  88. /**
  89. * Use the built-in static server for basic HTML/JS/CSS websites.
  90. * @property server
  91. * @type Object|Boolean
  92. * @default false
  93. */
  94. server: false,
  95. /**
  96. * Proxy an EXISTING vhost. Browsersync will wrap your vhost with a proxy URL to view your site.
  97. * @property proxy
  98. * @type String|Object|Boolean
  99. * @param {String} [target]
  100. * @param {Boolean} [ws] - Enable websocket proxying
  101. * @param {Function|Array} [middleware]
  102. * @param {Function} [reqHeaders]
  103. * @param {Array} [proxyReq]
  104. * @param {Array} [proxyRes]
  105. * @default false
  106. */
  107. proxy: false,
  108. /**
  109. * @property port
  110. * @type Number
  111. * @default 3000
  112. */
  113. port: 3000,
  114. /**
  115. * @property middleware
  116. * @type Function|Array
  117. * @default false
  118. */
  119. middleware: false,
  120. /**
  121. * Add additional directories from which static
  122. * files should be served. Should only be used in `proxy` or `snippet`
  123. * mode.
  124. * @property serveStatic
  125. * @type Array
  126. * @default []
  127. * @since 2.8.0
  128. */
  129. serveStatic: [],
  130. /**
  131. * Options that are passed to the serve-static middleware
  132. * when you use the string[] syntax: eg: `serveStatic: ['./app']`. Please see
  133. * [serve-static](https://github.com/expressjs/serve-static) for details
  134. *
  135. * @property serveStaticOptions
  136. * @type Object
  137. * @since 2.17.0
  138. */
  139. /**
  140. * Enable https for localhost development. **Note** - this is not needed for proxy
  141. * option as it will be inferred from your target url.
  142. * @property https
  143. * @type Boolean
  144. * @default undefined
  145. * @since 1.3.0
  146. */
  147. /**
  148. * Override http module to allow using 3rd party server modules (such as http2)
  149. * *Note*: these modules are not included in the Browsersync package - you need
  150. * to 'npm install' any that you'd like to use.
  151. * @property httpModule
  152. * @type string
  153. * @default undefined
  154. * @since 2.18.0
  155. */
  156. /**
  157. * Current working directory
  158. * @property cwd
  159. * @type String
  160. * @since 2.23.0
  161. */
  162. /**
  163. * Register callbacks via a regular option - this can be used
  164. * to get access the Browsersync instance in situations where you
  165. * cannot provide a callback via the normal API (for example, in a Gruntfile)
  166. *
  167. * **Note**: Only the `ready` callback is currently supported here.
  168. *
  169. * @property callbacks
  170. * @type Object
  171. * @param {Function} ready
  172. */
  173. /**
  174. * Clicks, Scrolls & Form inputs on any device will be mirrored to all others.
  175. * @property ghostMode
  176. * @param {Boolean} [clicks=true]
  177. * @param {Boolean} [scroll=true]
  178. * @param {Boolean} [location=true]
  179. * @param {Boolean} [forms=true]
  180. * @param {Boolean} [forms.submit=true]
  181. * @param {Boolean} [forms.inputs=true]
  182. * @param {Boolean} [forms.toggles=true]
  183. * @type Object
  184. */
  185. ghostMode: {
  186. clicks: true,
  187. scroll: true,
  188. location: true,
  189. forms: {
  190. submit: true,
  191. inputs: true,
  192. toggles: true
  193. }
  194. },
  195. /**
  196. * Can be either "info", "debug", "warn", or "silent"
  197. * @property logLevel
  198. * @type String
  199. * @default info
  200. */
  201. logLevel: "info",
  202. /**
  203. * Change the console logging prefix. Useful if you're creating your
  204. * own project based on Browsersync
  205. * @property logPrefix
  206. * @type String
  207. * @default Browsersync
  208. * @since 1.5.1
  209. */
  210. logPrefix: "Browsersync",
  211. /**
  212. * @property logConnections
  213. * @type Boolean
  214. * @default false
  215. */
  216. logConnections: false,
  217. /**
  218. * @property logFileChanges
  219. * @type Boolean
  220. * @default true
  221. */
  222. logFileChanges: true,
  223. /**
  224. * Log the snippet to the console when you're in snippet mode (no proxy/server)
  225. * @property logSnippet
  226. * @type: Boolean
  227. * @default true
  228. * @since 1.5.2
  229. */
  230. logSnippet: true,
  231. /**
  232. * You can prevent Browsersync from injecting the connection snippet
  233. * by passing `snippet: false`.
  234. * @property snippet
  235. * @type Boolean
  236. * @default undefined
  237. */
  238. /**
  239. * You can control how the snippet is injected
  240. * onto each page via a custom regex + function.
  241. * You can also provide patterns for certain urls
  242. * that should be ignored from the snippet injection.
  243. * @property snippetOptions
  244. * @since 2.0.0
  245. * @param {Boolean} [async] - should the script tags have the async attribute?
  246. * @param {Array} [blacklist]
  247. * @param {Array} [whitelist]
  248. * @param {RegExp} [rule.match=/$/]
  249. * @param {Function} [rule.fn=Function]
  250. * @type Object
  251. */
  252. snippetOptions: {
  253. async: true,
  254. whitelist: [],
  255. blacklist: [],
  256. rule: {
  257. match: /<body[^>]*>/i,
  258. fn: function (snippet, match) {
  259. return match + snippet;
  260. }
  261. }
  262. },
  263. /**
  264. * Add additional HTML rewriting rules.
  265. * @property rewriteRules
  266. * @since 2.4.0
  267. * @type Array
  268. * @default false
  269. */
  270. rewriteRules: [],
  271. /**
  272. * @property tunnel
  273. * @type String|Boolean
  274. * @default null
  275. */
  276. /**
  277. * Some features of Browsersync (such as `xip` & `tunnel`) require an internet connection, but if you're
  278. * working offline, you can reduce start-up time by setting this option to `false`
  279. * @property online
  280. * @type Boolean
  281. * @default undefined
  282. */
  283. /**
  284. * Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set.
  285. * Can be `true`, `local`, `external`, `ui`, `ui-external`, `tunnel` or `false`
  286. * @property open
  287. * @type Boolean|String
  288. * @default true
  289. */
  290. open: "local",
  291. /**
  292. * @property browser
  293. * @type String|Array
  294. * @default default
  295. */
  296. browser: "default",
  297. /**
  298. * Add HTTP access control (CORS) headers to assets served by Browsersync.
  299. * @property cors
  300. * @type boolean
  301. * @default false
  302. * @since 2.16.0
  303. */
  304. cors: false,
  305. /**
  306. * Requires an internet connection - useful for services such as [Typekit](https://typekit.com/)
  307. * as it allows you to configure domains such as `*.xip.io` in your kit settings
  308. * @property xip
  309. * @type Boolean
  310. * @default false
  311. */
  312. xip: false,
  313. hostnameSuffix: false,
  314. /**
  315. * Reload each browser when Browsersync is restarted.
  316. * @property reloadOnRestart
  317. * @type Boolean
  318. * @default false
  319. */
  320. reloadOnRestart: false,
  321. /**
  322. * The small pop-over notifications in the browser are not always needed/wanted.
  323. * @property notify
  324. * @type Boolean
  325. * @default true
  326. */
  327. notify: true,
  328. /**
  329. * @property scrollProportionally
  330. * @type Boolean
  331. * @default true
  332. */
  333. scrollProportionally: true,
  334. /**
  335. * @property scrollThrottle
  336. * @type Number
  337. * @default 0
  338. */
  339. scrollThrottle: 0,
  340. /**
  341. * Decide which technique should be used to restore
  342. * scroll position following a reload.
  343. * Can be `window.name` or `cookie`
  344. * @property scrollRestoreTechnique
  345. * @type String
  346. * @default 'window.name'
  347. */
  348. scrollRestoreTechnique: "window.name",
  349. /**
  350. * Sync the scroll position of any element
  351. * on the page. Add any amount of CSS selectors
  352. * @property scrollElements
  353. * @type Array
  354. * @default []
  355. * @since 2.9.0
  356. */
  357. scrollElements: [],
  358. /**
  359. * Sync the scroll position of any element
  360. * on the page - where any scrolled element
  361. * will cause all others to match scroll position.
  362. * This is helpful when a breakpoint alters which element
  363. * is actually scrolling
  364. * @property scrollElementMapping
  365. * @type Array
  366. * @default []
  367. * @since 2.9.0
  368. */
  369. scrollElementMapping: [],
  370. /**
  371. * Time, in milliseconds, to wait before
  372. * instructing the browser to reload/inject following a
  373. * file change event
  374. * @property reloadDelay
  375. * @type Number
  376. * @default 0
  377. */
  378. reloadDelay: 0,
  379. /**
  380. * Wait for a specified window of event-silence before
  381. * sending any reload events.
  382. * @property reloadDebounce
  383. * @type Number
  384. * @default 0
  385. * @since 2.6.0
  386. */
  387. reloadDebounce: 500,
  388. /**
  389. * Emit only the first event during sequential time windows
  390. * of a specified duration.
  391. * @property reloadThrottle
  392. * @type Number
  393. * @default 0
  394. * @since 2.13.0
  395. */
  396. reloadThrottle: 0,
  397. /**
  398. * User provided plugins
  399. * @property plugins
  400. * @type Array
  401. * @default []
  402. * @since 2.6.0
  403. */
  404. plugins: [],
  405. /**
  406. * @property injectChanges
  407. * @type Boolean
  408. * @default true
  409. */
  410. injectChanges: true,
  411. /**
  412. * @property startPath
  413. * @type String|Null
  414. * @default null
  415. */
  416. startPath: null,
  417. /**
  418. * Whether to minify client script, or not.
  419. * @property minify
  420. * @type Boolean
  421. * @default true
  422. */
  423. minify: true,
  424. /**
  425. * @property host
  426. * @type String
  427. * @default null
  428. */
  429. host: null,
  430. /**
  431. * Specify a host to listen on. Use this if you want to
  432. * prevent binding to all interfaces.
  433. *
  434. * Note: When you specify this option, it overrides the 'host' option
  435. * @property listen
  436. * @type String
  437. * @default undefined
  438. */
  439. /**
  440. * Support environments where dynamic hostnames are not required
  441. * (ie: electron)
  442. * @property localOnly
  443. * @type Boolean
  444. * @default false
  445. * @since 2.14.0
  446. */
  447. localOnly: false,
  448. /**
  449. * @property codeSync
  450. * @type Boolean
  451. * @default true
  452. */
  453. codeSync: true,
  454. /**
  455. * @property timestamps
  456. * @type Boolean
  457. * @default true
  458. */
  459. timestamps: true,
  460. clientEvents: [
  461. "scroll",
  462. "scroll:element",
  463. "input:text",
  464. "input:toggles",
  465. "form:submit",
  466. "form:reset",
  467. "click"
  468. ],
  469. /**
  470. * Alter the script path for complete control over where the Browsersync
  471. * Javascript is served from. Whatever you return from this function
  472. * will be used as the script path.
  473. * @property scriptPath
  474. * @default undefined
  475. * @since 1.5.0
  476. * @type Function
  477. */
  478. /**
  479. * Configure the Socket.IO path and namespace & domain to avoid collisions.
  480. * @property socket
  481. * @param {String} [path="/browser-sync/socket.io"]
  482. * @param {String} [clientPath="/browser-sync"]
  483. * @param {String|Function} [namespace="/browser-sync"]
  484. * @param {String|Function} [domain=undefined]
  485. * @param {String|Function} [port=undefined]
  486. * @param {Object} [clients.heartbeatTimeout=5000]
  487. * @since 1.6.2
  488. * @type Object
  489. */
  490. socket: {
  491. socketIoOptions: {
  492. log: false
  493. },
  494. socketIoClientConfig: {
  495. reconnectionAttempts: 50
  496. },
  497. path: "/browser-sync/socket.io",
  498. clientPath: "/browser-sync",
  499. namespace: "/browser-sync",
  500. clients: {
  501. heartbeatTimeout: 5000
  502. }
  503. },
  504. /**
  505. * Configure the script domain
  506. * @property script
  507. * @param {String|Function} [domain=undefined]
  508. * @since 2.14.0
  509. * @type Object
  510. */
  511. tagNames: {
  512. less: "link",
  513. scss: "link",
  514. css: "link",
  515. jpg: "img",
  516. jpeg: "img",
  517. png: "img",
  518. svg: "img",
  519. gif: "img",
  520. js: "script"
  521. },
  522. injectFileTypes: ["css", "png", "jpg", "jpeg", "svg", "gif", "webp", "map"],
  523. injectNotification: false,
  524. excludedFileTypes: [
  525. "js",
  526. "css",
  527. "pdf",
  528. "map",
  529. "svg",
  530. "ico",
  531. "woff",
  532. "json",
  533. "eot",
  534. "ttf",
  535. "png",
  536. "jpg",
  537. "jpeg",
  538. "webp",
  539. "gif",
  540. "mp4",
  541. "mp3",
  542. "3gp",
  543. "ogg",
  544. "ogv",
  545. "webm",
  546. "m4a",
  547. "flv",
  548. "wmv",
  549. "avi",
  550. "swf",
  551. "scss"
  552. ]
  553. };
  554. //# sourceMappingURL=default-config.js.map