Coder Social home page Coder Social logo

cycle-hot-reloading-example's Introduction

cycle-hot-reloading-example

A Cycle.js starter project with hot reloading using browserify and browserify-hmr.

Usage

To get set up:

git clone https://github.com/Widdershin/cycle-hot-reloading-example.git
cd cycle-hot-reloading-example
npm install
npm start

You should then be able to visit localhost:8000 and you'll see the text 'Change me!'.

You can then go into src/app.js and change that text, and you should see the result straight away without the page reloading.

You can also change the styles in styles.css and it will live reload.

This is made possible by AgentME/browserify-hmr, along with mattdesl's excellent budo development server. All of the hot reloading configuration is done in index.js. The key part is that the old Cycle application is diposed every time the code changes.

Deployment

To get your project online, if you don't need a backend server, you can deploy to Github pages.

Note: if you cloned this repo directly, you will first need to create a new repo. Since you're uploading an existing repo, don't add a README, license or .gitignore. Then follow the instructions to add your new repo as the remote. You will need to git remote rm origin beforehand.

To deploy for the first time, we need to set up a gh-pages branch:

git checkout -b gh-pages
npm run bundle
git add .
git commit -m "Add bundled app"
git push origin gh-pages

Then visit http://username.github.io/repository. Your site should be online within 5 minutes or so.

To update your site in future, just checkout back to the branch and repeat the process:

git checkout gh-pages
git merge master --no-edit
npm run bundle
git add .
git commit -m "Update bundle"
git push origin gh-pages

cycle-hot-reloading-example's People

Contributors

raquelxmoss avatar widdershin 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

Watchers

 avatar  avatar  avatar  avatar  avatar

cycle-hot-reloading-example's Issues

Production script?

I know budo is for prototyping and stuff, but I was wondering if a production script (essentially babelify + uglify -> bundle.js and then serve with a server) could easily be written for this. I'm not very knowledgeable about Browserify. Thanks!

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.