Skip to content

Instantly share code, notes, and snippets.

@pauldijou
Last active December 14, 2015 20:49
Show Gist options
  • Save pauldijou/5146606 to your computer and use it in GitHub Desktop.
Save pauldijou/5146606 to your computer and use it in GitHub Desktop.
Init AngularJS / PlayFramework files
'use strict'
app = angular.module('app', ['ngResource'])
.constant('apiUrl', 'http://localhost:9000\:9000/api/v1')
.config(['$routeProvider', ($routeProvider) ->
$routeProvider
.when('/', {
templateUrl: '/views/index',
controller: 'IndexCtrl'
})
.otherwise({
redirectTo: '/'
})
])
.config(['$locationProvider', ($locationProvider) ->
$locationProvider.html5Mode(true)
])
app.controller('AppCtrl', ['$scope', '$routeParams', ($scope, $routeParams) ->
])
app.controller('IndexCtrl', ['$scope', '$routeParams', ($scope, $routeParams) ->
])
class Entity
class Service
# This is the main configuration file for the application.
# ~~~~~
# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
application.secret="azekjlazkejazZ/iI_xa5nv<EeG:J<eazkjeazelkjzaea"
# The application languages
# ~~~~~
application.langs="en"
# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
# application.global=Global
# Router
# ~~~~~
# Define the Router object to use for this application.
# This router will be looked up first when the application is starting up,
# so make sure this is the entry point.
# Furthermore, it's assumed your route file is named properly.
# So for an application router like `my.application.Router`,
# you may need to define a router file `conf/my.application.routes`.
# Default to Routes in the root package (and conf/routes)
# application.router=my.application.Routes
# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
# db.default.driver=org.h2.Driver
# db.default.url="jdbc:h2:mem:play"
# db.default.user=sa
# db.default.password=""
# Evolutions
# ~~~~~
# You can disable evolutions if needed
# evolutionplugin=disabled
# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
# Root logger:
logger.root=ERROR
# Logger used by the framework:
logger.play=INFO
# Logger provided to your application:
logger.application=DEBUG
application.name=jege
application.stage=DEV
application.version="0.0.1"
package controllers
import play.api._
import play.api.mvc._
object Application extends Controller {
def main(any: String) = Action {
Ok(views.html.templates.main())
}
def index = Action {
Ok(views.html.index())
}
}
module.exports = (grunt) ->
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-concat')
grunt.loadNpmTasks('grunt-contrib-jshint')
grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-contrib-livereload')
grunt.loadNpmTasks('grunt-regarde')
grunt.loadNpmTasks('grunt-recess')
grunt.registerTask('default', ['build', 'livereload-start', 'regarde'])
grunt.registerTask('build', ['coffeeCompile', 'lessCompile'])
grunt.registerTask('coffeeCompile', ['concat:coffee', 'coffee', 'uglify'])
grunt.registerTask('lessCompile', ['recess'])
grunt.initConfig
pkg : grunt.file.readJSON('package.json')
appdir: 'app'
publicdir: 'public'
resourcesdir: 'resources'
jsdir: '<%= publicdir %>/javascripts'
cssdir: '<%= publicdir %>/stylesheets'
lessdir: '<%= resourcesdir %>/less'
coffeedir: '<%= resourcesdir %>/coffee'
gendir: '<%= resourcesdir %>/generated'
filename: '<%= pkg.name %>'
filenameversion: '<%= filename %>-<%= pkg.version %>'
meta:
banner : '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
coffee:
compile:
files:
'<%= jsdir %>/<%= filenameversion %>.js': '<%= gendir %>/<%= filename %>.coffee'
recess:
raw:
options:
compile:true
files:
'<%= cssdir %>/<%= filenameversion %>.css': ['<%= lessdir %>/main.less']
min:
options:
compile:true
compress: true
files:
'<%= cssdir %>/<%= filenameversion %>.min.css': ['<%= cssdir %>/<%= filenameversion %>.css']
uglify:
js:
files:
'<%= jsdir %>/<%= filenameversion %>.min.js': [ '<%= jsdir %>/<%= filenameversion %>.js' ]
jshint:
options:
curly: true
eqeqeq: true
immed: true
latedef: true
newcap: true
noarg: true
sub: true
undef: true
boss: true
eqnull: true
browser: true
globals:
jQuery: true
angular: true
console: true
Prism: true
app: true
all: ['Gruntfile.js', '<%= jsdir %>/**/*.js']
concat:
coffee:
files:
'<%= gendir %>/<%= filename %>.coffee': ['<%= coffeedir %>/app/app.coffee', '<%= coffeedir %>/**/*.coffee']
regarde:
gruntfile:
files: ["Gruntfile.coffee"]
tasks: ["build"]
coffee:
files: ["resources/coffee/**/*"]
tasks: ["coffeeCompile"]
less:
files: ["resources/less/**/*"]
tasks: ["lessCompile"]
js:
files: ["public/javascripts/**/*"]
tasks: ["livereload"]
css:
files: ["public/stylesheets/**/*"]
tasks: ["livereload"]
app:
files: ["app/**/*"]
tasks: ["livereload"]
conf:
files: ["conf/*"]
tasks: ["livereload"]
@()
@import play.api.Play
@import play.api.Play.current
@defining(Play.configuration) { config =>
@defining(config.getString("application.name").getOrElse("")) { applicationName =>
@defining(config.getString("application.stage").getOrElse("")) { applicationStage =>
@defining(config.getString("application.version").getOrElse("")) { applicationVersion =>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" data-ng-app="app" data-ng-controller="AppCtrl"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" data-ng-app="app" data-ng-controller="AppCtrl"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" data-ng-app="app" data-ng-controller="AppCtrl"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" data-ng-app="app" data-ng-controller="AppCtrl">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="fragment" content="!" />
<title>Easi18n</title>
@if(applicationStage == "DEV") {
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/"+applicationName+"-"+applicationVersion+".css")">
}
@if(applicationStage == "PROD") {
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/"+applicationName+"-"+applicationVersion+".min.css")">
}
<link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")">
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
</head>
<body>
<div class="container">
<div data-ng-view="view"></div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.4/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.4/angular-resource.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.3/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/bootstrap.min.js"></script>
@if(applicationStage == "DEV") {
<script src="@routes.Assets.at("javascripts/"+applicationName+"-"+ applicationVersion +".js")"></script>
<script src="http://localhost:35729/livereload.js?snipver=1"></script>
}
@if(applicationStage == "PROD") {
<script src="@routes.Assets.at("javascripts/"+applicationName+"-"+ applicationVersion +".min.js")"></script>
}
</body>
</html>
}
}
}
}
{
"author": "Paul Dijou",
"name": "jege",
"description": "Game engine",
"version": "0.0.1",
"homepage": "TODO",
"repository": {
"type": "git",
"url": "TODO"
},
"engines": {
"node": ">= 0.8.4"
},
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.0",
"grunt-contrib-coffee": "~0.6.0",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-jshint": "~0.2.0",
"grunt-contrib-uglify": "~0.1.2",
"grunt-contrib-livereload": "~0.1.2",
"grunt-regarde": "~0.1.2",
"grunt-recess": "~0.3.1"
}
}
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / controllers.Application.main(any = "none")
# Views
GET /views/index controllers.Application.index
# API
# Assets
GET /assets/*file controllers.Assets.at(path="/public", file)
# Fallback
GET /*any controllers.Application.main(any)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment