GithubHelp home page GithubHelp logo

qdrk / play-browsersync Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blogsamples/play-browsersync

0.0 3.0 0.0 120 KB

Proof of concept of using BrowserSync in top of Play Framework

Scala 51.91% JavaScript 38.65% CSS 9.44%

play-browsersync's Introduction

Play - BrowserSync

This project is a proof of concept to enable all the awesome features of BrowserSync in top of a Play Framework server. Also using Gulp to demonstrate how to both compile and reload assets.

Blog post

You can find my blog post explaining quickly all about that project on my website.

Setup

This setup assumes you already have sbt and NPM installed on your machine.

  1. Go to the root of the project
  • Run npm install to grab some dependencies
  • Open 2 shells
  • Run sbt run in the first one and wait for it to finish. You should have a Play server running now.
  • Run gulp in the second one, this will start a BrowserSync proxy on top of the Play server (run npm install -g gulp if you don't have gulp yet).
  • Enjoy the result at http://localhost:9001

Live-reloading

BrowserSync is configured to listen to the following files and live-reload them:

  • app/views/index.scala.html : a Scala template, will trigger a full reload of the page, and so on a compilation of the template by Play
  • public/javascript/main.js : a JavaScript file, will trigger a full reload of the page
  • resources/less/main.less : a LESS file, watched by Gulp, that will be automatically compiled to public/stylesheets/main.css, which is watched by BrowserSync and will be hot deployed (the page will be repainted with the new CSS without a full reload)

Multi-device sync

The 2nd killer feature of BrowserSync (after the live-reloading) is to sync your app across several devices. Meaning that you can open http://localhost:9001 in several browsers, in several devices (desktop, tablet, smartphone, ...) and start interacting with them. All basic actions, like clicking, touching, scrolling, ... will been replicated on all devices. This is pure awesomeness.

Author

Just me... Paul Dijou

License

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                    Version 2, December 2004

 Copyright (C) 2014 Paul Dijou

 Everyone is permitted to copy and distribute verbatim or modified
 copies of this license document, and changing it is allowed as long
 as the name is changed.

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. You just DO WHAT THE FUCK YOU WANT TO.

play-browsersync's People

Contributors

pauldijou avatar

Watchers

fpvsim avatar James Cloos avatar  avatar

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.