Example #1
0
        public ServerPlugin(SiteObject site, Lazy <WatcherPlugin> watcher) : base(site)
        {
            _watcher    = watcher;
            AppBuilders = new OrderedList <Action <IApplicationBuilder> >();

            sockets = new HashSet <WebSocket>();

            // Setup by default livereload
            Site.SetLiveReload(true);

            // Adds the server command
            ServerCommand = Site.CommandLine.Command("serve", newApp =>
            {
                newApp.Description = "Builds the website, runs a web server and watches for changes";
                newApp.HelpOption("-h|--help");
                newApp.Invoke = Server;
            }, false);

            noWatchOption = ServerCommand.Option("-n|--no-watch", "Disables watching files and triggering of a new run", CommandOptionType.NoValue);
        }