Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Added per mimetype reload strategies and stylesheet live reloading. #187

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Mike-Dax
Copy link
Contributor

@Mike-Dax Mike-Dax commented Feb 26, 2017

Per mimeType reload strategies have been added. Now you should be able to call enableLiveReload() without any arguments and get something that works very out of the box. Alternatively you can pass in an options object that contains your reload strategy.

  'strategy': {
    'text/html': 'naive',
    'text/tsx': 'react-hmr',
    'text/jsx': 'react-hmr',
    'application/javascript': 'react-hmr',
    'text/stylus': 'hot-stylesheets',
    'text/sass': 'hot-stylesheets',
    'text/scss': 'hot-stylesheets',
    'text/css' : 'hot-stylesheets'
  }

Additionally, stylesheets can now be hot reloaded. Their link.href will be reset upon the file changing.

This doesn't work for dependencies for stylesheets. I've opened an issue regarding electron-compile-compiled-file not being sent for dependencies for stylesheets in #188.

img.src = img.src; // trigger an update
}
}
} else {*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the status of this commented out code? Is this related to #188?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to make it so we could hot reload assets like images, but I'm not sure how these are treated by the dependency finder. If it's relatively plug and play I'll finish that up otherwise we can remove it.

}

export function enableLiveReload(options=defaultOptions) {
let { strategy } = options;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotta handle the old syntax here (i.e. { strategy: 'naive' }) or else it is a breaking change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Done in the latest commit.

@anaisbetts
Copy link
Contributor

This is awesome! I'm gonna have a look at this later today

@szymonkaliski
Copy link

any news on this? would love hot-reload for css

@Hum4n01d
Copy link

Hum4n01d commented Apr 10, 2017

Yes please! Hot reloading for CSS (I use Stylus) would make this package even more amazing than it already is!

@paulcbetts @malept @mnquintana Can’t wait!

@Hum4n01d
Copy link

Any news?

@anaisbetts
Copy link
Contributor

I could have sworn I reviewed and merged this. I'll have a look soon now that I'm back in the US

@Hum4n01d
Copy link

Ok thanks

@Hum4n01d
Copy link

Hum4n01d commented May 19, 2017

Hey @paulcbetts could you merge this? ;)

@Hum4n01d
Copy link

Hum4n01d commented Jun 2, 2017

Any news?

@shanehyde
Copy link

This looks like a great change, any reason it hasnt been merged yet?

@Hum4n01d
Copy link

Hum4n01d commented Sep 14, 2017 via email

@Coriou
Copy link

Coriou commented Mar 25, 2018

Hey, this PR has been opened for a year and it looks like something every body would want. Any reason it never got merged ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants