first commit

This commit is contained in:
didier amyot committed 2014-12-27 17:27:21 -08:00
commit 823ecdd500
26 files changed
+2110

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
logs/*
!.gitkeep
node_modules/
bower_components/
tmp
.DS_Store
.idea
+24
View File
@@ -0,0 +1,24 @@
{
"name": "angular-requirejs-seed",
"description": "AngularJS seed project modified for requireJS support.",
"version": "0.2.0",
"homepage": "https://github.com/tnajdek/angular-requirejs-seed",
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "~1.2.1",
"angular-route": "~1.2.1",
"angular-scenario": "~1.2.1",
"angular-mocks": "~1.2.1",
"requirejs": "~2.1.9",
"requirejs-text": "~2.0.10",
"foundation": "zurb/bower-foundation",
"html5-boilerplate": "~4.3.0"
}
}
+17
View File
@@ -0,0 +1,17 @@
define [
"angular"
"filters"
"services"
"directives"
"controllers"
"angularRoute"
], (angular, filters, services, directives, controllers) ->
# Declare app level module which depends on filters, and services
angular.module "myApp", [
"ngRoute"
"myApp.filters"
"myApp.services"
"myApp.directives"
"myApp.controllers"
]
+38
View File
@@ -0,0 +1,38 @@
define ["angular", "services"], (angular) ->
# Controllers
# Sample controller where service is being used
# More involved example where controller is required from an external file
controllers = angular.module("myApp.controllers", ["myApp.services"])
controllers.controller("MyCtrl1", [
"$scope"
"$injector"
($scope, $injector) ->
require ["controllers/myctrl1"], (myctrl1) ->
# injector method takes an array of modules as the first argument
# if you want your controller to be able to use components from
# any of your other modules, make sure you include it together with 'ng'
# Furthermore we need to pass on the $scope as it's unique to this controller
$injector.invoke(myctrl1, this, {$scope: $scope})
return
])
controllers.controller( "MyCtrl2", [
"$scope"
"$injector"
($scope, $injector) ->
require ["controllers/myctrl2"], (myctrl2) ->
# injector method takes an array of modules as the first argument
# if you want your controller to be able to use components from
# any of your other modules, make sure you include it together with 'ng'
# Furthermore we need to pass on the $scope as it's unique to this controller
$injector.invoke(myctrl2, this, {$scope: $scope})
return
])
+15
View File
@@ -0,0 +1,15 @@
define [], ->
[
"$scope"
"$http"
($scope, $http) ->
# You can access the scope of the controller from here
$scope.welcomeMessage = "hey this is myctrl1.coffee!"
$scope.okay = "okay?"
# because this has happened asynchroneusly we've missed
# Angular's initial call to $apply after the controller has been loaded
# hence we need to explicityly call it at the end of our Controller constructor
$scope.$apply()
]
+14
View File
@@ -0,0 +1,14 @@
define [], ->
[
"$scope"
"$http"
($scope, $http) ->
# You can access the scope of the controller from here
$scope.welcomeMessage = "hey this is myctrl2.coffee!"
# because this has happened asynchroneusly we've missed
# Angular's initial call to $apply after the controller has been loaded
# hence we need to explicityly call it at the end of our Controller constructor
$scope.$apply()
]
+14
View File
@@ -0,0 +1,14 @@
define [
"angular"
"services"
], (angular, services) ->
# Directives
angular.module("myApp.directives", ["myApp.services"]).directive "appVersion", [
"version"
(version) ->
return (scope, elm, attrs) ->
elm.text version
return
]
return
+10
View File
@@ -0,0 +1,10 @@
define ["angular", "services"], (angular, services) ->
# Filters
angular.module("myApp.filters", ["myApp.services"]).filter "interpolate", [
"version"
(version) ->
return (text) ->
String(text).replace /\%VERSION\%/g, version
]
return
+28
View File
@@ -0,0 +1,28 @@
require.config
paths:
angular: "/bower_components/angular/angular"
angularRoute: "/bower_components/angular-route/angular-route"
angularMocks: "/bower_components/angular-mocks/angular-mocks"
text: "/bower_components/requirejs-text/text"
shim:
angular:
exports: "angular"
angularRoute: ["angular"]
angularMocks:
deps: ["angular"]
exports: "angular.mock"
priority: ["angular"]
#http://code.angularjs.org/1.2.1/docs/guide/bootstrap#overview_deferred-bootstrap
window.name = "NG_DEFER_BOOTSTRAP!"
require ["angular", "app", "routes"], (angular, app, routes) ->
$html = angular.element(document.getElementsByTagName("html")[0])
angular.element().ready ->
angular.resumeBootstrap [app["name"]]
return
return
+17
View File
@@ -0,0 +1,17 @@
define [
"angular"
"app"
], (angular, app) ->
app.config [
"$routeProvider"
($routeProvider) ->
$routeProvider.when "/view1",
templateUrl: "/partials/partial1.html"
controller: "MyCtrl1"
$routeProvider.when "/view2",
templateUrl: "/partials/partial2.html"
controller: "MyCtrl2"
$routeProvider.otherwise redirectTo: "/view1"
]
+8
View File
@@ -0,0 +1,8 @@
define ["angular"], (angular) ->
# Services
# Demonstrate how to register services
# In this case it is a simple value service.
angular.module("myApp.services", []).value "version", "0.1"
return
+41
View File
@@ -0,0 +1,41 @@
var bower = require('gulp-bower');
var gulp = require('gulp');
var coffee = require('gulp-coffee');
var help = require('gulp-task-listing');
var clean = require('gulp-clean');
var sass = require('gulp-sass');
gulp.task('help', help);
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest('bower_components/'))
});
gulp.task('sass', ['bower'], function () {
return gulp.src('./scss/*.scss')
.pipe(sass({includePaths: ['bower_components/foundation/scss']}))
.pipe(gulp.dest('./css'));
});
gulp.task('coffee', ['bower'], function() {
return gulp.src('coffee/**/*.coffee')
.pipe(coffee({bare: true}))
.pipe(gulp.dest('js/'))
});
gulp.task('clean', function(){
return gulp.src(["js/", "bower_components/", "css/"], {read: false})
.pipe(clean())
});
gulp.task('default', ['bower', 'sass', 'coffee']);
gulp.task('dev', ['bower', 'coffee'], function(){
gulp.watch('coffee/**/*.coffee', ['coffee']);
gulp.watch('./scss/*.scss', ['sass']);
});
+25
View File
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en" ng-app="myApp" class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Angular-RequireJS sample app</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/css/style.css"/>
<script src="/bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js"></script>
</head>
<body>
<h1>AngularJS + RequireJS</h1>
<ul class="menu">
<li><a href="#/view1">view1</a></li>
<li><a href="#/view2">view2</a></li>
</ul>
<div ng-view></div>
<div>AngularJS + RequireJS seed app: v<span app-version></span></div>
<script data-main="/js/main" src="/bower_components/requirejs/require.js"></script>
</body>
</html>
+11
View File
@@ -0,0 +1,11 @@
{
"dependencies": {
"gulp": "~3.8.9",
"gulp-bower": "0.0.7",
"gulp-clean": "~0.3.1",
"gulp-coffee": "~2.2.0",
"gulp-sass": "^1.2.4",
"gulp-task-listing": "~0.3.0",
"node-sass": "~1.2.3"
}
}
+5
View File
@@ -0,0 +1,5 @@
<p>This is the partial for view 1.</p>
<p>
Getting version from the scope: {{ scopedAppVersion }}
</p>
<h1>{{ okay }}</h1>
+8
View File
@@ -0,0 +1,8 @@
<p>This is the partial for view 2.</p>
<p>
{{ welcomeMessage }}
</p>
<p>
Showing of 'interpolate' filter:
{{ 'Current version is v%VERSION%.' | interpolate }}
</p>
File diff suppressed because it is too large. Load diff
+40
View File
@@ -0,0 +1,40 @@
@import "settings";
@import "foundation";
// Or selectively include components
// @import
// "foundation/components/accordion",
// "foundation/components/alert-boxes",
// "foundation/components/block-grid",
// "foundation/components/breadcrumbs",
// "foundation/components/button-groups",
// "foundation/components/buttons",
// "foundation/components/clearing",
// "foundation/components/dropdown",
// "foundation/components/dropdown-buttons",
// "foundation/components/flex-video",
// "foundation/components/forms",
// "foundation/components/grid",
// "foundation/components/inline-lists",
// "foundation/components/joyride",
// "foundation/components/keystrokes",
// "foundation/components/labels",
// "foundation/components/magellan",
// "foundation/components/orbit",
// "foundation/components/pagination",
// "foundation/components/panels",
// "foundation/components/pricing-tables",
// "foundation/components/progress-bars",
// "foundation/components/reveal",
// "foundation/components/side-nav",
// "foundation/components/split-buttons",
// "foundation/components/sub-nav",
// "foundation/components/switch",
// "foundation/components/tables",
// "foundation/components/tabs",
// "foundation/components/thumbs",
// "foundation/components/tooltips",
// "foundation/components/top-bar",
// "foundation/components/type",
// "foundation/components/offcanvas",
// "foundation/components/visibility";