Giter VIP home page Giter VIP logo

livepage's Introduction

Hi ๐Ÿ‘‹ I'm Mike Rogers

Buy Me A Coffee donate button

I am a Ruby on Rails developer from the UK.

If you like my work, please consider buying me a coffee - every coffee is really appreciated!

๐Ÿ“ซ Connect With Me

If you'd to talk with me about Ruby, please feel free to message me on Twitter or send me an email [email protected].

๐Ÿ›  My Current Projects

๐Ÿณ Technology I Like

Ruby Rails Postgres Docker GitHub Actions Heroku HTML5 CSS3 Bootstrap

๐Ÿ“š Latest Blog Posts

๐Ÿ“บ Latest YouTube Videos

livepage's People

Contributors

codeandcats avatar mikerogers0 avatar timsayshey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

livepage's Issues

Hierarchy of CSS-files

my main issue with live-reload is that it generates new files at the bottom of the head. This makes sense so it can overwrite the previous declared rules (cascading).

If you now have two different CSS-files and the first one gets changed it gets generated at the bottom of the head... Here's an example:

`<link href="/assets/main.css media="screen" rel="stylesheet">

`

In main.css I have the rule body {background: white;} and in dark.css I have body {background: black;}

So if I change something in main.css (not the background, just anything else) the new CSS file gets placed at the bottom:

`<link href="/assets/main.css media="screen" rel="stylesheet">

****`

So even if I didn't change the value of body in main.css I now get a white background instead of the black background.

It really would make sense to place the new files beneath the previous file, like:

`<link href="/assets/main.css media="screen" rel="stylesheet">
<link href="/assets/main.css&livePage=123456789?LivePage=123456789 media="screen" rel="stylesheet">

`

this way the cascading would still be intakt. Hope you understand what I mean.

Can get contents of html pages but not css pages

If you havent read this answer yet, please note I have edited it with a quick fix, however I don't think it is a good thing
Hi
This is a great little plugin by the way. I am trying to print out the contents of the file that has changed. This works fine when the file type that changed is html, however when its javascript or css, it doesnt seem to get set.

In LiveResource.prototype.check() there is the line _this.response = _this.tidyCode(this.responseText);. If I console.log(this.responseText) it is not set to anything. Whats interesting is it does notice the file change and refresh the page. Any ideas why this might be happening?

EDIT: Looking at the inspector in Chrome, I can see the css file being loaded:

image

I am interested that its being loaded over HTTP HEAD protocol, and the file has no content/response:

image

even though the file loaded fine:

image

EDIT: OK I have fixed it, but I am suspicious as to my fix. By changing the line:

this.method = 'HEAD';

to

this.method = 'GET';

It now works. However Im not sure why it was set to HEAD for all files not html and therefore what I have undone by changing that? I think it will just slow down the connection but without the body Im not sure why we were checking the headers only?

vs LiveReload / Grunt Integration

Just curious as I evaluate various livereload options...

What are the advantages of LivePage vs LiveReload?

Do you have anything on the roadmap for Grunt integration? Or will this extension accept the same protocol as LiveReload, making grunt-contrib-livereload viable here?

Thanks!

Add option for custom rest time checks

For external hosted websites (like shopify) with lots of assets 1000ms is locking my browser down even though i have a decent computer/network. While probably extension may need some performance improvements i think manually entering a number more than 1000ms would be very good i think.

For now i manually changed it from web inspector to 10000ms and it's better.

PS: I have a page with 3d transitions with very large assets and scroll movement is important. When it reloads the page it freezes scroll action for 1 second or so.

Don't monitor 404 files

Currently, LivePage will keep yielding errors if there is a 404 file:

screenshot

I think this can be an option:
Should LivePage ignore non-existing files

so we can get rid of these errors in some cases.

NotFoundError: Failed to execute 'insertBefore' on 'Node'

Got the following error while trying to update CSS:

Uncaught NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
LiveResource.refresh @ live_resource.js:140
xhr.onreadystatechange @ live_resource.js:74
XMLHttpRequest.send (async)LiveResource.check @ live_resource.js:79
livePage.check @ livepage.js:180
livePage.checkBatch @ livepage.js:163
(anonymous function) @ livepage.js:181
setTimeout (async)(anonymous function) @ livepage.js:181
xhr.onreadystatechange @ live_resource.js:56
XMLHttpRequest.send (async)LiveResource.check @ live_resource.js:79
livePage.check @ livepage.js:180
livePage.checkBatch @ livepage.js:163
(anonymous function) @ livepage.js:181
setTimeout (async)(anonymous function) @ livepage.js:181
xhr.onreadystatechange @ live_resource.js:56

Any ideas why it happens and how it can be fixed?

Multi-threaded polling

It currently runs in the same thread as the web page. I want to experiment with the boosts in performance I can gain using web workers.

Synchronous XMLHttpRequest on the main thread is deprecated

Not important yet but just for heads up my chrome dev tool is throwing this warning:

livepage.js:297:
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/. 

screenshot 2015-02-01 00 44 19

@import bug

I have two CSS files in the /css/ folder.

First one is styles.css, second is reset.css.

@import url(reset.css); from the styles.css doesn't work.

When http://test/index.html is opened:

HEAD http://test/reset.css?livePage=1354648256605 500 (Internal Server Error) 
LiveResource.check
livePage.check
livePage.checkBatch
(anonymous function)

Right path is http://test/css/reset.css

Getting request but page not reloading

My current stack is Heroku and Django with Sublime Text 2 and Chrome (OS X 10.11.2), and I can't seem to get my local pages to update. I can see the requests being made but the page doesn't reload.

Doesn't reload while Chrome is not focused

I have an editor and chrome open. When I make a change in the editor and save, nothing happens until I alt-tab back over to chrome. Then the change instantly takes effect.

Maybe Chrome doesn't let the background JS run while out of focus or something?

This is Chrome 38 beta.

Make options affect active tabs

So "LivePage will run on" in the options page will update in the background & the option pages setting with take instant affect.

Increase Polling Setting time?

I'm wondering if there is some way to increase the polling setting time to let's say every 5 - 10 minutes?

I'm trying to use it as a way of displaying live info on a remote screen that only needs to update in 5 minutes intervals and the 1000ms seems to decrease the performance of the slide show that displays the data.

excellent extension

but this doesn't work with any templating system right?

we actually use twig a lot and making changes to templates does not issue a reload.

Duplicate Domain in URL with Leading Slash

When rewriting a domains and paths, the domain is duplicated and a leading slash is added, causing the Chrome extension to 404 every file and eventually reload ever 2-3 seconds.

In my case, a URL like http://client.dev/main.css becomes /http://client.dev/main.css. That leading slash then causes the browser to request http://client.dev/http://client.dev/main.css.

I suspect this comes from the way you re-join the parts of the stack var around livepage.js:47.

LESS reloading crashes

Works perfectly with html and css, but when i update less file it crashes.
It notices the change and logs it in the console ( ["refreshing", "........*.less", liveResource] ) and then it crashes saying this
Uncaught ReferenceError: $LivePageLESS is not defined livepage.js:405
LiveResource.refresh livepage.js:405
LiveResource.check livepage.js:329
livePage.check livepage.js:246
livePage.checkBatch livepage.js:214
(anonymous function) livepage.js:217

Batch checking of URLS

Check URLs in batches, as sites with lots of resources still feel live. It might be a shout to store the last changed file & check it more frequently.

Multiple same CSS-files

One thing I was noticing is that when you have your inspector (Chrome-Devtools) open and your CSS gets live-reloaded you have the exact same rules listed twice: (I changed something else than the body rule in my file)

main.css&livePage=123456789?LivePage=123456789:1
body {background:white;}

main.css:1
body {background:white;}

I would like the old files removed (maybe make it an option you can specify).

Would kinda solve the last issue I posted as well if you just replace the old file with the new one keeping the CSS-hierarchy intakt. (except if you use transitions for changes to CSS, then you need both files, personally I don't)

If somethings unclear I can try explaining differently or just post a screenshot to clear things up.

Cheers

CSS files issue

It seems that LivePage doesn't work for the CSS-files.

<link rel="stylesheet" href="./css/global.css">

No updates are handled for the files like this one.
In other hand, it works for the .html files.

What is the solution?

OS Windows 7.
Chrome version 21.

LiveJS works well.

Using IntelliJ to debug HTML/Javascript, LivePage errors out

In IntelliJ, you can debug javascript in the browser by having the IDE host the pages and connecting to Chrome dev apis. When doing this, LivePage does not work, and prints out the following errors:

Uncaught TypeError: $livePage.checkBatch is not a function
(anonymous function)
Uncaught TypeError: Cannot read property 'refresh_rate' of undefined
(anonymous function)
xhr.onreadystatechange

I really can't say any more than this, other than it happens no matter what page I try to debug, so duplicating it shouldn't be a problem. I'm using the enterprise edition of IntelliJ, so I can't say if it happens on the Community edition.

Info: OSX 10.8, Chrome 49, LivePage 1.6.1, IntelliJ 15.0.1

Anchors viewed as new page

When brosing a webpage using anchors, it disables LivePage. It shouldn't take care of the anchor in the URL.

Uncaught TypeError In Console when using React

Uncaught TypeError: Cannot read property 'refresh_rate' of undefined

I've encountered the following error which does not seem to effect functionality but is repeatedly posted in the console upon live page changes (although not consistently).

I think this has something to do with a need for 'mutual exclusion' during each call of Settings.refresh()- the settings class might benefit from a more asynchronous approach.

sendMessage Error

I am getting the following issue after which LivePage stops checking.

LivePage: Starting Up
LivePage: ["Scanning Page"]
LivePage: ["Monitoring http://Censored/ at higher priority"]
LivePage: ["Monitoring 19 resources",
Array[19]
]
LivePage: ["Refreshing", "http://Censored/",
LiveResource
]
Uncaught TypeError: Object # has no method 'sendMessage'
LiveResource.refresh
LiveResource.check
livePage.checkBatch
(anonymous function)

Refresh resets scroll location to top

I'm using LivePage to auto-refresh a site that has a greater height than my viewport. When I'm scrolled all the way to the bottom (say I'm working on the footer), and I make a change, the auto-refresh often leaves me at the very top of the page.

This does not happen all the time. But I can reproduce it fairly good by modifying the padding of an element. If I modify the color of the same element though, it never happens. This makes me think it could be a problem related to the changing document height.

PHP includes - eg. Wordpress

Wordpress uses PHP includes to generate the page, not static HTML - so any changes to those includes don't automatically show.

eg. The site url might show "domain.com/about/" but be showing content from header.php & page.php etc.

I tried using the link rel in the header as follows but without success:

link rel="livePage" href="/wp-content/themes/themename/page.php"

Is there any method that I could use to enable this, or could you incorporate this into your detection?

I also tried http://blog.readingroom.com/2011/10/27/live-js-why-its-amazing-and-getting-it-to-work-with-php-files/ but it didn't work either.

Thanks!

EDIT: For Wordpress - use this plugin instead https://wordpress.org/plugins/wp-livephp/
I'll still use Livepage for all non PHP included work.

Won't reload CSS whilst HTTP headers do change.

For some reason the CSS is not reloaded

I'm comparing the headers printed in the array in my console (debugging is turned on) to the headers in the network panel coming back from the HEAD request. The Last-Modified and ETag headers are both changing in response to an edit. But nothing happens.

I'd like the debug this myself, but not sure how to use the dev. tools on this extension (it's not listed in content scripts).

Any clues to what might be wrong?

Getting a 404 on Google Font CDN

I use an @import of font files in my CSS.

@import url(//fonts.googleapis.com/css?family=Roboto+Condensed:300italic,400italic,700italic,700,300,400);

But getting a 404 error : the extension seems to try loading it on my localhost :

http://localhost/site/css/http://fonts.googleapis.com/css?family=โ€ฆCondensed:300italic,400italic,700italic,700,300,400&livePage=1363103351970

CDN are disabled in the option page of the extension.

Add support for additional file extensions

For a project I'm currently working on, I'm using .shtml files which aren't being detected as being updated. Maybe a feature where you can list your own extensions to watch would be useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.