-
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 72a62f2
Showing
30 changed files
with
900 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,3 @@ | ||
{ | ||
"directory": "bower_components" | ||
} |
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,10 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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,4 @@ | ||
node_modules | ||
bower_components | ||
public/css | ||
public/js |
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,22 @@ | ||
{ | ||
"node": true, | ||
"es5": true, | ||
"esnext": true, | ||
"bitwise": true, | ||
"camelcase": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"immed": true, | ||
"indent": 2, | ||
"latedef": true, | ||
"newcap": true, | ||
"noarg": true, | ||
"quotmark": "single", | ||
"regexp": true, | ||
"undef": true, | ||
"unused": true, | ||
"strict": true, | ||
"trailing": true, | ||
"smarttabs": true, | ||
"white": true | ||
} |
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,251 @@ | ||
module.exports = function(grunt) { | ||
grunt.option('stack', true); | ||
|
||
var port = process.env.PORT || 8000, | ||
hostname = 'localhost', | ||
templates = {}, | ||
paths = { | ||
'public': 'public', | ||
output: { | ||
js: 'public/js', | ||
css: 'public/css' | ||
}, | ||
js: 'js', | ||
css: 'css', | ||
templates: 'js/templates', | ||
views: 'js/views', | ||
models: 'js/models', | ||
collections: 'js/collections' | ||
}; | ||
|
||
// Register required tasks | ||
grunt.loadTasks('tasks'); | ||
grunt.loadNpmTasks('thorax-inspector'); | ||
require('matchdep').filterDev('grunt-*').forEach(function(task) { | ||
if (task !== 'grunt-cli') { | ||
grunt.loadNpmTasks(task); | ||
} | ||
}); | ||
|
||
grunt.config.init({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
paths: paths, | ||
clean: { | ||
output: [ | ||
paths.output.js, | ||
paths.output.css | ||
] | ||
}, | ||
copy: { | ||
requirejs: { | ||
files: [ | ||
{ | ||
src: 'bower_components/requirejs/require.js', | ||
dest: 'public/js/require.js' | ||
} | ||
] | ||
}, | ||
styles: { | ||
files: [ | ||
{ | ||
expand: true, | ||
cwd: paths.css, | ||
src: '*.css', | ||
dest: paths.output.css | ||
} | ||
] | ||
}, | ||
bootstrap: { | ||
files: [ | ||
{ | ||
src: ['bower_components/bootstrap/dist/js/bootstrap.js'], | ||
dest: 'public/js/bootstrap.js' | ||
}, | ||
{ | ||
src: ['bower_components/bootstrap/dist/css/bootstrap.css'], | ||
dest: 'public/css/bootstrap.css' | ||
}, | ||
{ | ||
expand: true, | ||
flatten: true, | ||
src: ['bower_components/bootstrap/fonts/*'], | ||
dest: 'public/fonts' | ||
} | ||
] | ||
} | ||
}, | ||
connect: { | ||
development: { | ||
options: { | ||
hostname: hostname, | ||
base: paths.public, | ||
port: port | ||
} | ||
}, | ||
production: { | ||
options: { | ||
hostname: hostname, | ||
base: paths.public, | ||
port: port, | ||
keepalive: true | ||
} | ||
} | ||
}, | ||
thorax: { | ||
inspector: { | ||
editor: 'subl', | ||
background: true, | ||
paths: { | ||
views: paths.views, | ||
models: paths.models, | ||
collections: paths.collections, | ||
templates: paths.templates | ||
} | ||
} | ||
}, | ||
requirejs: { | ||
development: getRequireJSOptions('development'), | ||
production: getRequireJSOptions('production') | ||
}, | ||
handlebars: { | ||
templates: { | ||
options: { | ||
namespace: false, | ||
amd: true | ||
} | ||
} | ||
}, | ||
watch: { | ||
handlebars: { | ||
files: [paths.templates + '/**/*.hbs'], | ||
tasks: ['templates'] | ||
}, | ||
scripts: { | ||
files: [ | ||
paths.js + '/**/*.js' | ||
], | ||
tasks: ['scripts:development'] | ||
}, | ||
styles: { | ||
files: [paths.css + '/**/*'], | ||
tasks: ['copy:styles'] | ||
} | ||
} | ||
}); | ||
|
||
function getRequireJSOptions(env) { | ||
var options = { | ||
appDir: paths.js, | ||
baseUrl: './', | ||
dir: paths.output.js, | ||
modules: [ | ||
{ | ||
name: 'main' | ||
} | ||
], | ||
paths: { | ||
'jquery': '../bower_components/jquery/jquery', | ||
'underscore': '../bower_components/underscore/underscore', | ||
'handlebars': '../bower_components/handlebars/handlebars.runtime', | ||
'backbone': '../bower_components/backbone/backbone', | ||
'thorax': '../bower_components/thorax/thorax', | ||
'bootstrap': '../bower_components/bootstrap/js/bootstrap' | ||
}, | ||
shim: { | ||
'handlebars': { | ||
exports: 'Handlebars' | ||
}, | ||
'backbone': { | ||
exports: 'Backbone', | ||
deps: ['jquery', 'underscore'] | ||
}, | ||
'underscore': { | ||
exports: '_' | ||
}, | ||
'thorax': { | ||
exports: 'Thorax', | ||
deps: ['handlebars', 'backbone'] | ||
}, | ||
'bootstrap': { | ||
deps: ['jquery'] | ||
} | ||
} | ||
}; | ||
if (env === 'production') { | ||
/* | ||
TODO | ||
options.keepBuildDir = true; | ||
options.optimize = 'uglify'; | ||
*/ | ||
} | ||
if (env === 'development') { | ||
options.keepBuildDir = true; | ||
options.optimize = 'none'; | ||
} | ||
return { | ||
options: options | ||
}; | ||
} | ||
|
||
grunt.registerTask('open-browser', function () { | ||
var open = require('open'); | ||
open('http://' + hostname + ':' + port); | ||
}); | ||
|
||
grunt.registerTask('scripts:development', [ | ||
'copy:requirejs', | ||
'requirejs:development' | ||
]); | ||
|
||
grunt.registerTask('scripts:production', [ | ||
'copy:requirejs', | ||
'requirejs:production' | ||
]); | ||
|
||
grunt.registerTask('update-templates-list', function() { | ||
// Set up the templates object for Handlebars | ||
grunt.file.glob.sync(paths.templates + '/**/*.{handlebars,hbs}').forEach(function (file) { | ||
var target = paths.output.js + '/templates' + file.substr(paths.templates.length).replace(/\.(?:handlebars|hbs)$/, '.js'); | ||
templates[target] = file; | ||
}); | ||
grunt.config.set('handlebars.templates.files', templates); | ||
}); | ||
|
||
grunt.registerTask('create-output-directories', function() { | ||
grunt.file.mkdir('public/js'); | ||
grunt.file.mkdir('public/css'); | ||
}); | ||
|
||
grunt.registerTask('templates', [ | ||
'update-templates-list', | ||
'handlebars:templates' | ||
]); | ||
|
||
grunt.registerTask('styles', [ | ||
'copy:styles', | ||
'copy:bootstrap' | ||
]); | ||
|
||
grunt.registerTask('default', [ | ||
'ensure-installed', | ||
'clean:output', | ||
'create-output-directories', | ||
'styles', | ||
'templates', | ||
'scripts:development', | ||
'thorax:inspector', | ||
'connect:development', | ||
'open-browser', | ||
'watch' | ||
]); | ||
|
||
grunt.registerTask('production', [ | ||
'clean:output', | ||
'create-output-directories', | ||
'styles', | ||
'templates', | ||
'scripts:production', | ||
'open-browser', | ||
'connect:production' | ||
]); | ||
}; |
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,40 @@ | ||
Thorax & Parse Todo Seed | ||
======================== | ||
|
||
### *Example of persistent ToDos with Facebook authentication using Thorax and Parse* | ||
|
||
|
||
|
||
Configuration | ||
------------- | ||
|
||
|
||
|
||
- Create a [Facebook Application] | ||
|
||
- Register & Create a new app at Parse.com | ||
|
||
- Edit your /js/routers/todo-list.js and replace the placeholders with your | ||
Parse initialize script & Facebook App ID | ||
|
||
Parse.initialize("REPLACE ME", "REPLACE ME"); | ||
|
||
window.fbAsyncInit = function() { | ||
|
||
Parse.FacebookUtils.init({ | ||
|
||
appId : 'REPLACE ME', | ||
|
||
cookie : true, | ||
|
||
xfbml : true | ||
|
||
}); | ||
|
||
}; | ||
|
||
- Run npm start | ||
|
||
- ? | ||
|
||
- PROFIT |
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 @@ | ||
{ | ||
"name": "-todo-parse", | ||
"version": "0.0.0", | ||
"dependencies": { | ||
"requirejs": "~2.1", | ||
"thorax": "~2.0", | ||
"bootstrap": "~3.0" | ||
} | ||
} |
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 @@ | ||
body { padding-top: 50px; } |
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 @@ | ||
.done { | ||
text-decoration: line-through; | ||
} | ||
input[type="checkbox"] { margin-right: 10px; } | ||
button { width: 100%; } |
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 @@ | ||
define(['thorax'], function (Thorax) { | ||
return Thorax.CollectionView.extend({ | ||
|
||
}); | ||
}); |
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 @@ | ||
define(['thorax'], function (Thorax) { | ||
return Thorax.Collection.extend({ | ||
|
||
}); | ||
}); |
Empty file.
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 @@ | ||
define(['thorax'], function (Thorax) { | ||
return Thorax.LayoutView.extend({ | ||
|
||
}); | ||
}); |
Oops, something went wrong.