Skip to content

Commit 140d802

Browse files
committed
init project
0 parents  commit 140d802

31 files changed

+1579
-0
lines changed

.bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "app/components"
3+
}

.editorconfig

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
8+
[*]
9+
10+
# Change these settings to your own preference
11+
indent_style = space
12+
indent_size = 2
13+
14+
# We recommend you to keep these unchanged
15+
end_of_line = lf
16+
charset = utf-8
17+
trim_trailing_whitespace = true
18+
insert_final_newline = true
19+
20+
[*.md]
21+
trim_trailing_whitespace = false

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
dist
3+
.tmp
4+
.sass-cache
5+
app/components
6+
info
7+
hooks

.jshintrc

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"node": true,
3+
"browser": true,
4+
"es5": true,
5+
"esnext": true,
6+
"bitwise": true,
7+
"camelcase": true,
8+
"curly": true,
9+
"eqeqeq": true,
10+
"immed": true,
11+
"indent": 2,
12+
"latedef": true,
13+
"newcap": true,
14+
"noarg": true,
15+
"quotmark": "single",
16+
"regexp": true,
17+
"undef": true,
18+
"unused": true,
19+
"strict": true,
20+
"trailing": true,
21+
"smarttabs": true,
22+
"globals": {
23+
"angular": false
24+
}
25+
}

Gruntfile.js

+318
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
'use strict';
2+
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
3+
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
4+
var mountFolder = function (connect, dir) {
5+
return connect.static(require('path').resolve(dir));
6+
};
7+
8+
module.exports = function (grunt) {
9+
// load all grunt tasks
10+
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
11+
12+
// configurable paths
13+
var yeomanConfig = {
14+
app: 'app',
15+
dist: 'dist'
16+
};
17+
18+
try {
19+
yeomanConfig.app = require('./component.json').appPath || yeomanConfig.app;
20+
} catch (e) {}
21+
22+
grunt.initConfig({
23+
yeoman: yeomanConfig,
24+
watch: {
25+
coffee: {
26+
files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
27+
tasks: ['coffee:dist']
28+
},
29+
coffeeTest: {
30+
files: ['test/spec/{,*/}*.coffee'],
31+
tasks: ['coffee:test']
32+
},
33+
compass: {
34+
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
35+
tasks: ['compass']
36+
},
37+
livereload: {
38+
files: [
39+
'<%= yeoman.app %>/{,*/}*.html',
40+
'{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
41+
'{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
42+
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
43+
],
44+
tasks: ['livereload']
45+
}
46+
},
47+
connect: {
48+
options: {
49+
port: 9000,
50+
// Change this to '0.0.0.0' to access the server from outside.
51+
hostname: 'localhost'
52+
},
53+
proxies: [
54+
{
55+
context: '/api',
56+
host: 'localhost',
57+
port: 2480,
58+
https: false,
59+
changeOrigin: false,
60+
rewrite: {
61+
'^/api': ''
62+
}
63+
}
64+
],
65+
livereload: {
66+
options: {
67+
middleware: function (connect) {
68+
return [
69+
proxySnippet,
70+
mountFolder(connect, '.tmp'),
71+
mountFolder(connect, yeomanConfig.app)
72+
];
73+
}
74+
}
75+
},
76+
test: {
77+
options: {
78+
middleware: function (connect) {
79+
return [
80+
mountFolder(connect, '.tmp'),
81+
mountFolder(connect, 'test')
82+
];
83+
}
84+
}
85+
}
86+
},
87+
open: {
88+
server: {
89+
url: 'http://localhost:<%= connect.options.port %>'
90+
}
91+
},
92+
clean: {
93+
dist: {
94+
files: [{
95+
dot: true,
96+
src: [
97+
'.tmp',
98+
'<%= yeoman.dist %>/*',
99+
'!<%= yeoman.dist %>/.git*'
100+
]
101+
}]
102+
},
103+
server: '.tmp'
104+
},
105+
jshint: {
106+
options: {
107+
jshintrc: '.jshintrc'
108+
},
109+
all: [
110+
'Gruntfile.js',
111+
'<%= yeoman.app %>/scripts/{,*/}*.js'
112+
]
113+
},
114+
karma: {
115+
unit: {
116+
configFile: 'karma.conf.js',
117+
singleRun: true
118+
}
119+
},
120+
coffee: {
121+
dist: {
122+
files: [{
123+
expand: true,
124+
cwd: '<%= yeoman.app %>/scripts',
125+
src: '{,*/}*.coffee',
126+
dest: '.tmp/scripts',
127+
ext: '.js'
128+
}]
129+
},
130+
test: {
131+
files: [{
132+
expand: true,
133+
cwd: 'test/spec',
134+
src: '{,*/}*.coffee',
135+
dest: '.tmp/spec',
136+
ext: '.js'
137+
}]
138+
}
139+
},
140+
compass: {
141+
options: {
142+
sassDir: '<%= yeoman.app %>/styles',
143+
cssDir: '.tmp/styles',
144+
imagesDir: '<%= yeoman.app %>/images',
145+
javascriptsDir: '<%= yeoman.app %>/scripts',
146+
fontsDir: '<%= yeoman.app %>/styles/fonts',
147+
importPath: '<%= yeoman.app %>/components',
148+
relativeAssets: true
149+
},
150+
dist: {},
151+
server: {
152+
options: {
153+
debugInfo: true
154+
}
155+
}
156+
},
157+
concat: {
158+
dist: {
159+
files: {
160+
'<%= yeoman.dist %>/scripts/scripts.js': [
161+
'.tmp/scripts/{,*/}*.js',
162+
'<%= yeoman.app %>/scripts/{,*/}*.js'
163+
]
164+
}
165+
}
166+
},
167+
useminPrepare: {
168+
html: '<%= yeoman.app %>/index.html',
169+
options: {
170+
dest: '<%= yeoman.dist %>'
171+
}
172+
},
173+
usemin: {
174+
html: ['<%= yeoman.dist %>/{,*/}*.html'],
175+
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
176+
options: {
177+
dirs: ['<%= yeoman.dist %>']
178+
}
179+
},
180+
imagemin: {
181+
dist: {
182+
files: [{
183+
expand: true,
184+
cwd: '<%= yeoman.app %>/images',
185+
src: '{,*/}*.{png,jpg,jpeg}',
186+
dest: '<%= yeoman.dist %>/images'
187+
}]
188+
}
189+
},
190+
cssmin: {
191+
dist: {
192+
files: {
193+
'<%= yeoman.dist %>/styles/main.css': [
194+
'.tmp/styles/{,*/}*.css',
195+
'<%= yeoman.app %>/styles/{,*/}*.css'
196+
]
197+
}
198+
}
199+
},
200+
htmlmin: {
201+
dist: {
202+
options: {
203+
/*removeCommentsFromCDATA: true,
204+
// https://github.com/yeoman/grunt-usemin/issues/44
205+
//collapseWhitespace: true,
206+
collapseBooleanAttributes: true,
207+
removeAttributeQuotes: true,
208+
removeRedundantAttributes: true,
209+
useShortDoctype: true,
210+
removeEmptyAttributes: true,
211+
removeOptionalTags: true*/
212+
},
213+
files: [{
214+
expand: true,
215+
cwd: '<%= yeoman.app %>',
216+
src: ['*.html', 'views/*.html'],
217+
dest: '<%= yeoman.dist %>'
218+
}]
219+
}
220+
},
221+
cdnify: {
222+
dist: {
223+
html: ['<%= yeoman.dist %>/*.html']
224+
}
225+
},
226+
ngmin: {
227+
dist: {
228+
files: [{
229+
expand: true,
230+
cwd: '<%= yeoman.dist %>/scripts',
231+
src: '*.js',
232+
dest: '<%= yeoman.dist %>/scripts'
233+
}]
234+
}
235+
},
236+
uglify: {
237+
dist: {
238+
files: {
239+
'<%= yeoman.dist %>/scripts/scripts.js': [
240+
'<%= yeoman.dist %>/scripts/scripts.js'
241+
]
242+
}
243+
}
244+
},
245+
rev: {
246+
dist: {
247+
files: {
248+
src: [
249+
'<%= yeoman.dist %>/scripts/{,*/}*.js',
250+
'<%= yeoman.dist %>/styles/{,*/}*.css',
251+
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
252+
'<%= yeoman.dist %>/styles/fonts/*'
253+
]
254+
}
255+
}
256+
},
257+
copy: {
258+
dist: {
259+
files: [{
260+
expand: true,
261+
dot: true,
262+
cwd: '<%= yeoman.app %>',
263+
dest: '<%= yeoman.dist %>',
264+
src: [
265+
'*.{ico,txt}',
266+
'.htaccess',
267+
'components/**/*',
268+
'images/{,*/}*.{gif,webp}',
269+
'styles/fonts/*'
270+
]
271+
}]
272+
}
273+
}
274+
});
275+
276+
grunt.renameTask('regarde', 'watch');
277+
278+
grunt.registerTask('server', [
279+
'clean:server',
280+
'coffee:dist',
281+
'compass:server',
282+
'configureProxies',
283+
'livereload-start',
284+
'connect:livereload',
285+
'open',
286+
'watch'
287+
]);
288+
289+
grunt.registerTask('test', [
290+
'clean:server',
291+
'coffee',
292+
'compass',
293+
'connect:test',
294+
'karma'
295+
]);
296+
297+
grunt.registerTask('build', [
298+
'clean:dist',
299+
'jshint',
300+
'test',
301+
'coffee',
302+
'compass:dist',
303+
'useminPrepare',
304+
'imagemin',
305+
'cssmin',
306+
'htmlmin',
307+
'concat',
308+
'copy',
309+
'cdnify',
310+
'ngmin',
311+
'uglify',
312+
'rev',
313+
'usemin'
314+
]);
315+
316+
grunt.registerTask('default', ['build']);
317+
grunt.loadNpmTasks('grunt-connect-proxy');
318+
};

app/.buildignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.coffee

0 commit comments

Comments
 (0)