forked from solomon23/solomon-angular-node-seed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5625dd9
Showing
92 changed files
with
47,622 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
public/css | ||
public/js | ||
s-seed.sublime-workspace | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
_ = require "underscore" | ||
Path = require "path" | ||
|
||
module.exports = (grunt) -> | ||
grunt.loadNpmTasks "grunt-contrib-coffee" | ||
grunt.loadNpmTasks "grunt-contrib-less" | ||
grunt.loadNpmTasks "grunt-contrib-requirejs" | ||
grunt.loadNpmTasks "grunt-contrib-watch" | ||
grunt.loadNpmTasks "grunt-contrib-cssmin" | ||
grunt.loadNpmTasks "grunt-contrib-copy" | ||
grunt.loadNpmTasks "grunt-contrib-clean" | ||
|
||
grunt.loadNpmTasks "grunt-newer" | ||
grunt.loadNpmTasks "grunt-nodemon" | ||
grunt.loadNpmTasks "grunt-concurrent" | ||
grunt.loadNpmTasks "grunt-angular-templates" | ||
grunt.loadNpmTasks "grunt-filerev" | ||
grunt.loadNpmTasks "grunt-filerev-assets" | ||
|
||
|
||
grunt.registerTask "default", ["build"] | ||
|
||
# combine the javascript files using the requirejs config | ||
grunt.registerTask "jscombine", "Require.Js optimization", -> | ||
config = require "./client/js/require-config.coffee" | ||
|
||
rjsClientConfig = config.requireConfig | ||
|
||
# client build config needs some extra items | ||
_.extend rjsClientConfig, | ||
name: './lib/almond' | ||
baseUrl: "build/temp" | ||
include: ["js/main.js"] | ||
out: "./build/public/js/combined.js" | ||
|
||
grunt.config.set "requirejs", | ||
optimize: | ||
options: rjsClientConfig | ||
|
||
grunt.task.run "requirejs" | ||
|
||
grunt.registerTask "server", ["builddev", "concurrent"] | ||
|
||
grunt.registerTask "builddev", [ | ||
# removing the public dir | ||
"clean:public" | ||
|
||
# turn the client coffee into js into the public folder | ||
"coffee:dev" | ||
|
||
# compile the less CSS | ||
"less:dev" | ||
|
||
# create the single template file | ||
"ngtemplates" | ||
] | ||
|
||
grunt.registerTask "build", [ | ||
# remove build folder | ||
"clean:build" | ||
|
||
# turn the client coffee into js in the build/temp | ||
"coffee:prod" | ||
|
||
# compile the templates | ||
"ngtemplates" | ||
|
||
# copy the templates and lib to build/temp | ||
"copy:client" | ||
|
||
# combine all the js files | ||
"jscombine" | ||
|
||
# compile the css | ||
"less:prod" | ||
|
||
# minify the css | ||
"cssmin" | ||
|
||
# set versions on all the files | ||
"filerev" | ||
|
||
# create a server map | ||
"filerev_assets" | ||
|
||
# copy over server coffee files | ||
"copy:server" | ||
|
||
# copy over deploy files | ||
"copy:heroku" | ||
|
||
# remove the temp files | ||
"clean:temp" | ||
] | ||
|
||
grunt.initConfig | ||
|
||
clean: | ||
build: | ||
files: [{ | ||
dot: true | ||
src: [ | ||
"build/*" | ||
"!build/.git*" | ||
] | ||
}] | ||
|
||
temp: ["build/temp"] | ||
|
||
public: ["public"] | ||
|
||
concurrent: | ||
dev: | ||
tasks: ["nodemon", "watch"] | ||
options: | ||
logConcurrentOutput: true | ||
|
||
nodemon: | ||
dev: | ||
options: | ||
watchedFolders: ["server"] | ||
file: "./server/app.coffee" | ||
|
||
coffee: | ||
dev: | ||
options: | ||
bare: true | ||
sourceMap: true | ||
sourceRoot: "" | ||
|
||
expand: true | ||
cwd: "client" | ||
src: ["./**/*.coffee"] | ||
dest: "public" | ||
ext: ".js" | ||
|
||
prod: | ||
options: | ||
bare: true | ||
sourceMap: false | ||
sourceRoot: "" | ||
|
||
expand: true | ||
cwd: "client" | ||
src: ["./**/*.coffee"] | ||
dest: "build/temp" | ||
ext: ".js" | ||
|
||
less: | ||
dev: | ||
options: yuicompress: true | ||
files: | ||
"./public/css/app.css": "./client/less/app.less" | ||
|
||
prod: | ||
files: | ||
"./build/temp/css/app.css": "./client/less/app.less" | ||
|
||
# put hash numbers on the assets | ||
filerev: | ||
files: | ||
src: [ | ||
"./build/public/js/**/*.js" | ||
"./build/public/lib/**/*.js" | ||
"./build/public/css/**/*.css" | ||
"./build/public/images/**/*.{png,jpg,jpeg,gif,webp,svg}" | ||
] | ||
|
||
# create a map file for all the assets | ||
filerev_assets: | ||
options: | ||
cwd: "build/public" | ||
dest: "build/server/assets.json" | ||
|
||
cssmin: | ||
minify: | ||
expand: true | ||
cwd: "build/temp" | ||
src: ["css/app.css"] | ||
dest: "build/public" | ||
ext: ".css" | ||
|
||
copy: | ||
client: | ||
files: [ | ||
# external lib files | ||
{expand: true, src: "lib/**/*.js", cwd: "client/", dest: "./build/temp/"} | ||
|
||
# combined template file | ||
{src: "public/js/templates.js", dest: "build/temp/js/templates.js"} | ||
|
||
# image files | ||
{expand: true, src: "images/**", cwd: "client/", dest: "./build/public/"} | ||
] | ||
server: | ||
files: [ | ||
{src: ["server/**"], dest: "build/"} | ||
] | ||
heroku: | ||
files: [ | ||
{src: ["Procfile"], dest: "build/"} | ||
{src: "package.json", dest: "build/package.json"} | ||
] | ||
|
||
ngtemplates: | ||
myApp: | ||
cwd: "./client" | ||
src: "./partials/**/*.html" | ||
dest:"./public/js/templates.js" | ||
options: | ||
htmlmin: collapseWhitespace: true, collapseBooleanAttributes: true | ||
bootstrap: (module, script) -> | ||
"define(['appModule'], function(appModule) {appModule.run(['$templateCache', function($templateCache){ #{script} }])});" | ||
|
||
watch: | ||
coffee: | ||
files: ["**/*.coffee"] | ||
tasks: ["newer:coffee:dev"] | ||
|
||
less: | ||
files: ["./client/less/**/*.less"] | ||
tasks: ["less:dev"] | ||
|
||
ngtemplates: | ||
files: ["client/partials/**.html"] | ||
tasks: ["ngtemplates"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: coffee server/app.coffee |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
define ["angular"], (angular) -> | ||
|
||
# setup the app | ||
angular.module("myApp", [ | ||
"ngRoute" | ||
]). | ||
config ["$routeProvider", ($routeProvider) -> | ||
# add app config here | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
define ["appModule"], (appModule) -> | ||
Page1Controller = ($scope, remote) -> | ||
_init = -> | ||
$scope.page = "page1" | ||
|
||
# gets data from a remote server | ||
remote.getData() | ||
.success (data) -> | ||
$scope.myData = data.message | ||
|
||
_init() | ||
|
||
# register the controller | ||
appModule.controller "Page1Controller", [ | ||
"$scope" | ||
"remote" | ||
Page1Controller | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
define ["appModule"], (appModule) -> | ||
|
||
Page2Controller = ($scope) -> | ||
$scope.page = "page2" | ||
|
||
|
||
# register the controller | ||
appModule.controller "Page2Controller", [ | ||
"$scope" | ||
Page2Controller | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
define ["appModule", "templates"], (appModule) -> | ||
|
||
RootController = ($scope, $route, $location) -> | ||
_init = -> | ||
$scope.location = $location | ||
|
||
_init() | ||
|
||
# register the controller | ||
appModule.controller "rootController", [ | ||
"$scope" | ||
"$route" | ||
"$location" | ||
RootController | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
define ["appModule"], (appModule) -> | ||
|
||
# Directive | ||
appVersion = (version) -> | ||
(scope, elm, attrs) -> | ||
elm.text version | ||
|
||
# register the directive | ||
appModule.directive "appVersion", [ | ||
"version" | ||
appVersion | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
define ["appModule"], (appModule) -> | ||
|
||
# Filter | ||
interpolate = (version) -> | ||
(text) -> | ||
String(text).replace /\%VERSION\%/mg, version | ||
|
||
appModule.filter "interpolate", [ | ||
"version" | ||
interpolate | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
define ["appModule"], (appModule) -> | ||
|
||
### | ||
Filter to map static content to versioned static content | ||
### | ||
staticFilter = -> | ||
(text) -> | ||
staticMapping[text] ? text | ||
|
||
appModule.filter "static", [ | ||
staticFilter | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
requirejs.config requireConfig if requireConfig? | ||
|
||
require [ | ||
"angular" | ||
"jquery" | ||
"underscore" | ||
"appModule" | ||
"templates" | ||
|
||
# bootstrap | ||
"lib/bootstrap/affix.js" | ||
"lib/bootstrap/alert.js" | ||
"lib/bootstrap/button.js" | ||
"lib/bootstrap/carousel.js" | ||
"lib/bootstrap/collapse.js" | ||
"lib/bootstrap/dropdown.js" | ||
"lib/bootstrap/modal.js" | ||
"lib/bootstrap/tooltip.js" | ||
"lib/bootstrap/popover.js" | ||
"lib/bootstrap/scrollspy.js" | ||
"lib/bootstrap/tab.js" | ||
"lib/bootstrap/transition.js" | ||
|
||
"lib/angular/angular-route.js" | ||
|
||
# the routes | ||
"js/routes.js" | ||
|
||
# services | ||
"js/services/version.js" | ||
"js/services/remote.js" | ||
|
||
# controllers | ||
"js/controllers/root.js" | ||
"js/controllers/page1.js" | ||
"js/controllers/page2.js" | ||
|
||
# filters | ||
"js/filters/interpolate.js" | ||
"js/filters/static.js" | ||
|
||
# directives | ||
"js/directives/app-version.js" | ||
|
||
], (angular) -> | ||
angular.bootstrap $("html"), ["myApp"] |
Oops, something went wrong.