Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  > Within that machine lies Org-mode.
  > ...
  > Absolute maniacs run their finances, their spreadsheets, 
  > and their fragile grip on reality out of it.
I feel seen... who else is with me?


Also...

  > I have to address the elephant in the room: 
  > hot-rebuilding isn't true hot-reloading. 
  > To get the browser to magically inject CSS without 
  > a refresh requires WebSockets, background Node
  > processes, and a lot of external baggage.
OR... you could just use inotify again... Behold this abomination (that works so well (on my machine) I can't believe it):

  __shite_hot_cmd_browser_refresh() {
      local window_id=${1:?"Fail. We expect window ID to be set in scope."}
  
      printf "%s\n" \
             "key --window ${window_id} --clearmodifiers 'F5'"
  }
  
  __shite_hot_cmd_goto_url() {
      local window_id=${1}
      local url=${2}
  
      printf "%s\n" \
             "key --window ${window_id} --clearmodifiers 'ctrl+l'" \
             "type --window ${window_id} --clearmodifiers --delay 1 ${url}" \
             "key --window ${window_id} --clearmodifiers 'Return'"
  }
... and a few functions later ...

  __shite_hot_cmd_exec() {
      # In debug mode, only show the actions, don't do them.
      if [[ ${SHITE_BUILD} == "hot" ]]
      then stdbuf -oL grep -v '^$' | __tap_stream | xdotool -
      else cat -
      fi
  }
  
  shite_hot_browser_reload() {
      local browser_window_id=${1:?"Fail. Window ID not set."}
      local base_url=${base_url:?"Fail. Base URL not set."}
      __shite_hot_cmd_public_events ${browser_window_id} ${base_url} |
          __shite_hot_cmd_exec
  }
... and finally ...

    # RUN PIPELINE
    shite_hot_watch_file_events ${watch_dir} |
        __shite_events_dedupe |
        __tap_stream |
        tee >(shite_hot_build ${base_url}) |
        # Perform hot-reload actions only against changes to public files
        tee >(shite_hot_browser_reload ${window_id} ${base_url})




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: