Skip to content

Commit 41100bb

Browse files
committed
Add sample-app used in Chapter 3
1 parent 1fd836e commit 41100bb

24 files changed

+22943
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

chapter3/sample-app/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

chapter3/sample-app/.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
intermediate/
2+
publish/
3+
temp/

chapter3/sample-app/Gruntfile.js

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
module.exports = function( grunt ) {
2+
'use strict';
3+
//
4+
// Grunt configuration:
5+
//
6+
// https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
7+
//
8+
grunt.initConfig({
9+
10+
// Project configuration
11+
// ---------------------
12+
13+
// specify an alternate install location for Bower
14+
bower: {
15+
dir: 'app/components'
16+
},
17+
18+
// Coffee to JS compilation
19+
coffee: {
20+
compile: {
21+
files: {
22+
'app/scripts/*.js': 'app/scripts/**/*.coffee',
23+
'test/spec/*.js': 'test/spec/**/*.coffee'
24+
}
25+
}
26+
},
27+
28+
// compile .scss/.sass to .css using Compass
29+
compass: {
30+
dist: {
31+
// http://compass-style.org/help/tutorials/configuration-reference/#configuration-properties
32+
options: {
33+
css_dir: 'temp/styles',
34+
sass_dir: 'app/styles',
35+
images_dir: 'app/images',
36+
javascripts_dir: 'temp/scripts',
37+
force: true
38+
}
39+
}
40+
},
41+
42+
// generate application cache manifest
43+
manifest:{
44+
dest: ''
45+
},
46+
47+
// default watch configuration
48+
watch: {
49+
coffee: {
50+
files: 'app/scripts/**/*.coffee',
51+
tasks: 'coffee reload'
52+
},
53+
compass: {
54+
files: [
55+
'app/styles/**/*.{scss,sass}'
56+
],
57+
tasks: 'compass reload'
58+
},
59+
reload: {
60+
files: [
61+
'app/*.html',
62+
'app/styles/**/*.css',
63+
'app/scripts/**/*.js',
64+
'app/views/**/*.html',
65+
'app/images/**/*'
66+
],
67+
tasks: 'reload'
68+
}
69+
},
70+
71+
// default lint configuration, change this to match your setup:
72+
// https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#lint-built-in-task
73+
lint: {
74+
files: [
75+
'Gruntfile.js',
76+
'app/scripts/**/*.js',
77+
'spec/**/*.js'
78+
]
79+
},
80+
81+
// specifying JSHint options and globals
82+
// https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#specifying-jshint-options-and-globals
83+
jshint: {
84+
options: {
85+
curly: true,
86+
eqeqeq: true,
87+
immed: true,
88+
latedef: true,
89+
newcap: true,
90+
noarg: true,
91+
sub: true,
92+
undef: true,
93+
boss: true,
94+
eqnull: true,
95+
browser: true
96+
},
97+
globals: {
98+
angular: true
99+
}
100+
},
101+
102+
// Build configuration
103+
// -------------------
104+
105+
// the staging directory used during the process
106+
staging: 'temp',
107+
// final build output
108+
output: 'dist',
109+
110+
mkdirs: {
111+
staging: 'app/'
112+
},
113+
114+
// Below, all paths are relative to the staging directory, which is a copy
115+
// of the app/ directory. Any .gitignore, .ignore and .buildignore file
116+
// that might appear in the app/ tree are used to ignore these values
117+
// during the copy process.
118+
119+
// concat css/**/*.css files, inline @import, output a single minified css
120+
css: {
121+
'styles/main.css': ['styles/**/*.css']
122+
},
123+
124+
// renames JS/CSS to prepend a hash of their contents for easier
125+
// versioning
126+
rev: {
127+
js: 'scripts/**/*.js',
128+
css: 'styles/**/*.css',
129+
img: 'images/**'
130+
},
131+
132+
// usemin handler should point to the file containing
133+
// the usemin blocks to be parsed
134+
'usemin-handler': {
135+
html: 'index.html'
136+
},
137+
138+
// update references in HTML/CSS to revved files
139+
usemin: {
140+
html: ['**/*.html'],
141+
css: ['**/*.css']
142+
},
143+
144+
// HTML minification
145+
html: {
146+
files: ['**/*.html']
147+
},
148+
149+
// Optimizes JPGs and PNGs (with jpegtran & optipng)
150+
img: {
151+
dist: '<config:rev.img>'
152+
},
153+
154+
// rjs configuration. You don't necessarily need to specify the typical
155+
// `path` configuration, the rjs task will parse these values from your
156+
// main module, using http://requirejs.org/docs/optimization.html#mainConfigFile
157+
//
158+
// name / out / mainConfig file should be used. You can let it blank if
159+
// you're using usemin-handler to parse rjs config from markup (default
160+
// setup)
161+
rjs: {
162+
// no minification, is done by the min task
163+
optimize: 'none',
164+
baseUrl: './scripts',
165+
wrap: true
166+
}
167+
});
168+
169+
// Alias the `test` task to run `testacular` instead
170+
grunt.registerTask('test', 'run the testacular test driver', function () {
171+
var done = this.async();
172+
require('child_process').exec('testacular start --single-run', function (err, stdout) {
173+
grunt.log.write(stdout);
174+
done(err);
175+
});
176+
});
177+
};

chapter3/sample-app/app/.buildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.coffee

0 commit comments

Comments
 (0)