All directories have the same configuration options. Passing an array of paths or glob patterns will allow you to watch multiple directories. (ie: when the server is ready to start accepting connections) Watching multiple paths: The second argument is an optional callback that will be sent to the LiveReload server and called for the listening event. (useful if you want to start it yourself later) noListen Pass as true to indicate that the websocket server should not be started automatically.Useful if the browser is reloading/refreshing before a file has been compiled, for example, by browserify. delay add a delay (in miliseconds) between when livereload detects a change to the filesystem and when it notifies the browser.Set this to true to successfully watch files over a network. usePolling Poll for file system changes.This lets you edit local CSS files but view a live site. overrideURL lets you specify a different host for CSS files.originalPath Set URL you use for development, e.g 'http:/', then LiveReload will proxy this url to local path.exclusions lets you specify files to ignore.Namely for these extensions: jpg, jpeg, png, gif applyImgLive tells LiveReload to reload image files in the background instead of refreshing the page.appl圜SSLive tells LiveReload to reload CSS files in the background instead of refreshing the page.extraExts is an array of extensions you want to observe.This overrides the default extensions of. exts is an array of extensions you want to observe.It defaults to 35729 which is what the LiveReload extensions use currently. https is an optional object of options to be passed to https.createServer (if not provided, http.createServer is used instead).The first are some configuration options, passed as a JavaScript object: The createServer() method accepts two arguments. You can then start up the server which will listen on port 3000. listen ( 3000 ) var livereload = require ( 'livereload' ) var lrserver = livereload. use ( static ( _dirname + '/public' ) ) server. Live_reload will match files in the sibling application.Var connect = require ( 'connect' ) var compiler = require ( 'connect-compiler' ) var static = require ( 'serve-static' ) var server = connect ( ) server. You'll also want to be sure that the configured :patterns for expand ( ) config :phoenix_live_reload, :dirs, ), Path. :phoenix_live_reload to trigger page reloads: # in config/dev.exs root_path = _ENV_. In an umbrella app, if you want to enable live reloading based on codeĬhanges in sibling applications, set the reloadable_apps option on yourĮndpoint to ensure the code will be recompiled, then add the dirs to Useful when class names are determined at runtime, for example when Page reload like other asset types instead of the default hot reload. :reload_page_on_css_changes - If true, CSS changes will trigger a full You can do so with the :suffix option: live_reload : Īnd then configure the endpoint to use the same suffix: if code_reloading? do socket "/phoenix/live_reload/socket/proxied/app/path",. You may want to give a different suffix to each socket connection. :suffix - if you are running live-reloading on an umbrella app, :url - the URL of the live reload socket connection. :target_window - the window that will be reloaded, as an atom. Expects a keyword list of atom keys and string values. :iframe_attrs - attrs to be given to the iframe injected by :debounce - an integer in milliseconds to wait before sending live_reload : [ patterns : [ ~r will beīroadcast on the topic whenever file in the list of patterns changes. Key of your endpoint, such as this: config :my_app, MyApp.Endpoint. In your Endpoint, ie: if code_reloading? do socket "/phoenix/live_reload/socket", plug Phoenix.CodeReloader plug Phoenix.LiveReloader endĪll live-reloading configuration must be done inside the :live_reload Router for live-reload detection in development.Īdd the Phoenix.LiveReloader plug within a code_reloading? block Settings View Source Phoenix.LiveReloader (Phoenix Live-Reload v1.4.1)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |