Git Product home page Git Product logo

play-hard-jsroutes's Introduction

play-hard-jsroutes

This Play 2.1.x application builds a hard routes file from the reverse javascript routes file using curl.

Intro

The reason why I built this was to make it easier to create a hard copy of the routes file. By having an actual routes file versus the dynamic one, the file can be minified and packaged when run through the r.js optimizer during a distribution. Thus reducing requests and increasing speed.

Usage

Clone repository and cd into the directory.

Add execute permissions to the buildroutes file:

chmod +x buildroutes.sh

To see how it works starting with play ~run will show a message - "No jsRoutes found."

RequireJS in this case is trying to require the routes.js file, but it doesn't exist yet, only the dynamically created dev-routes.js exists.

Stop the server and start it with play -Djsr=build ~run. This will trigger the buildroutes.sh script after the Play application has started and should result in showing the message - "Found jsRoutes."

There is a sleep 3; count to wait for the file to be written from the curl before play starts the server and can be adjusted.

Modify the buildroutes.sh file to suit your needs.

In a nutshell

Creates a hard routes file from the dynamically generated javascript routes file.

play -Djsr=build ~run

License

MIT: http://jmparsons.mit-license.org - @jmparsons

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.