default-config.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  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 control how the snippet is injected
  233. * onto each page via a custom regex + function.
  234. * You can also provide patterns for certain urls
  235. * that should be ignored from the snippet injection.
  236. * @property snippetOptions
  237. * @since 2.0.0
  238. * @param {Boolean} [async] - should the script tags have the async attribute?
  239. * @param {Array} [blacklist]
  240. * @param {Array} [whitelist]
  241. * @param {RegExp} [rule.match=/$/]
  242. * @param {Function} [rule.fn=Function]
  243. * @type Object
  244. */
  245. snippetOptions: {
  246. async: true,
  247. whitelist: [],
  248. blacklist: [],
  249. rule: {
  250. match: /<body[^>]*>/i,
  251. fn: function (snippet, match) {
  252. return match + snippet;
  253. }
  254. }
  255. },
  256. /**
  257. * Add additional HTML rewriting rules.
  258. * @property rewriteRules
  259. * @since 2.4.0
  260. * @type Array
  261. * @default false
  262. */
  263. rewriteRules: [],
  264. /**
  265. * @property tunnel
  266. * @type String|Boolean
  267. * @default null
  268. */
  269. /**
  270. * Some features of Browsersync (such as `xip` & `tunnel`) require an internet connection, but if you're
  271. * working offline, you can reduce start-up time by setting this option to `false`
  272. * @property online
  273. * @type Boolean
  274. * @default undefined
  275. */
  276. /**
  277. * Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set.
  278. * Can be `true`, `local`, `external`, `ui`, `ui-external`, `tunnel` or `false`
  279. * @property open
  280. * @type Boolean|String
  281. * @default true
  282. */
  283. open: "local",
  284. /**
  285. * @property browser
  286. * @type String|Array
  287. * @default default
  288. */
  289. browser: "default",
  290. /**
  291. * Add HTTP access control (CORS) headers to assets served by Browsersync.
  292. * @property cors
  293. * @type boolean
  294. * @default false
  295. * @since 2.16.0
  296. */
  297. cors: false,
  298. /**
  299. * Requires an internet connection - useful for services such as [Typekit](https://typekit.com/)
  300. * as it allows you to configure domains such as `*.xip.io` in your kit settings
  301. * @property xip
  302. * @type Boolean
  303. * @default false
  304. */
  305. xip: false,
  306. hostnameSuffix: false,
  307. /**
  308. * Reload each browser when Browsersync is restarted.
  309. * @property reloadOnRestart
  310. * @type Boolean
  311. * @default false
  312. */
  313. reloadOnRestart: false,
  314. /**
  315. * The small pop-over notifications in the browser are not always needed/wanted.
  316. * @property notify
  317. * @type Boolean
  318. * @default true
  319. */
  320. notify: true,
  321. /**
  322. * @property scrollProportionally
  323. * @type Boolean
  324. * @default true
  325. */
  326. scrollProportionally: true,
  327. /**
  328. * @property scrollThrottle
  329. * @type Number
  330. * @default 0
  331. */
  332. scrollThrottle: 0,
  333. /**
  334. * Decide which technique should be used to restore
  335. * scroll position following a reload.
  336. * Can be `window.name` or `cookie`
  337. * @property scrollRestoreTechnique
  338. * @type String
  339. * @default 'window.name'
  340. */
  341. scrollRestoreTechnique: "window.name",
  342. /**
  343. * Sync the scroll position of any element
  344. * on the page. Add any amount of CSS selectors
  345. * @property scrollElements
  346. * @type Array
  347. * @default []
  348. * @since 2.9.0
  349. */
  350. scrollElements: [],
  351. /**
  352. * Sync the scroll position of any element
  353. * on the page - where any scrolled element
  354. * will cause all others to match scroll position.
  355. * This is helpful when a breakpoint alters which element
  356. * is actually scrolling
  357. * @property scrollElementMapping
  358. * @type Array
  359. * @default []
  360. * @since 2.9.0
  361. */
  362. scrollElementMapping: [],
  363. /**
  364. * Time, in milliseconds, to wait before
  365. * instructing the browser to reload/inject following a
  366. * file change event
  367. * @property reloadDelay
  368. * @type Number
  369. * @default 0
  370. */
  371. reloadDelay: 0,
  372. /**
  373. * Wait for a specified window of event-silence before
  374. * sending any reload events.
  375. * @property reloadDebounce
  376. * @type Number
  377. * @default 0
  378. * @since 2.6.0
  379. */
  380. reloadDebounce: 500,
  381. /**
  382. * Emit only the first event during sequential time windows
  383. * of a specified duration.
  384. * @property reloadThrottle
  385. * @type Number
  386. * @default 0
  387. * @since 2.13.0
  388. */
  389. reloadThrottle: 0,
  390. /**
  391. * User provided plugins
  392. * @property plugins
  393. * @type Array
  394. * @default []
  395. * @since 2.6.0
  396. */
  397. plugins: [],
  398. /**
  399. * @property injectChanges
  400. * @type Boolean
  401. * @default true
  402. */
  403. injectChanges: true,
  404. /**
  405. * @property startPath
  406. * @type String|Null
  407. * @default null
  408. */
  409. startPath: null,
  410. /**
  411. * Whether to minify client script, or not.
  412. * @property minify
  413. * @type Boolean
  414. * @default true
  415. */
  416. minify: true,
  417. /**
  418. * @property host
  419. * @type String
  420. * @default null
  421. */
  422. host: null,
  423. /**
  424. * Specify a host to listen on. Use this if you want to
  425. * prevent binding to all interfaces.
  426. *
  427. * Note: When you specify this option, it overrides the 'host' option
  428. * @property listen
  429. * @type String
  430. * @default undefined
  431. */
  432. /**
  433. * Support environments where dynamic hostnames are not required
  434. * (ie: electron)
  435. * @property localOnly
  436. * @type Boolean
  437. * @default false
  438. * @since 2.14.0
  439. */
  440. localOnly: false,
  441. /**
  442. * @property codeSync
  443. * @type Boolean
  444. * @default true
  445. */
  446. codeSync: true,
  447. /**
  448. * @property timestamps
  449. * @type Boolean
  450. * @default true
  451. */
  452. timestamps: true,
  453. clientEvents: [
  454. "scroll",
  455. "scroll:element",
  456. "input:text",
  457. "input:toggles",
  458. "form:submit",
  459. "form:reset",
  460. "click"
  461. ],
  462. /**
  463. * Alter the script path for complete control over where the Browsersync
  464. * Javascript is served from. Whatever you return from this function
  465. * will be used as the script path.
  466. * @property scriptPath
  467. * @default undefined
  468. * @since 1.5.0
  469. * @type Function
  470. */
  471. /**
  472. * Configure the Socket.IO path and namespace & domain to avoid collisions.
  473. * @property socket
  474. * @param {String} [path="/browser-sync/socket.io"]
  475. * @param {String} [clientPath="/browser-sync"]
  476. * @param {String|Function} [namespace="/browser-sync"]
  477. * @param {String|Function} [domain=undefined]
  478. * @param {String|Function} [port=undefined]
  479. * @param {Object} [clients.heartbeatTimeout=5000]
  480. * @since 1.6.2
  481. * @type Object
  482. */
  483. socket: {
  484. socketIoOptions: {
  485. log: false
  486. },
  487. socketIoClientConfig: {
  488. reconnectionAttempts: 50
  489. },
  490. path: "/browser-sync/socket.io",
  491. clientPath: "/browser-sync",
  492. namespace: "/browser-sync",
  493. clients: {
  494. heartbeatTimeout: 5000
  495. }
  496. },
  497. /**
  498. * Configure the script domain
  499. * @property script
  500. * @param {String|Function} [domain=undefined]
  501. * @since 2.14.0
  502. * @type Object
  503. */
  504. tagNames: {
  505. less: "link",
  506. scss: "link",
  507. css: "link",
  508. jpg: "img",
  509. jpeg: "img",
  510. png: "img",
  511. svg: "img",
  512. gif: "img",
  513. js: "script"
  514. },
  515. injectFileTypes: ["css", "png", "jpg", "jpeg", "svg", "gif", "webp", "map"],
  516. injectNotification: false,
  517. excludedFileTypes: [
  518. "js",
  519. "css",
  520. "pdf",
  521. "map",
  522. "svg",
  523. "ico",
  524. "woff",
  525. "json",
  526. "eot",
  527. "ttf",
  528. "png",
  529. "jpg",
  530. "jpeg",
  531. "webp",
  532. "gif",
  533. "mp4",
  534. "mp3",
  535. "3gp",
  536. "ogg",
  537. "ogv",
  538. "webm",
  539. "m4a",
  540. "flv",
  541. "wmv",
  542. "avi",
  543. "swf",
  544. "scss"
  545. ]
  546. };
  547. //# sourceMappingURL=default-config.js.map