Skip to content

Commit 33504df

Browse files
committed
initial v0.0.2
0 parents  commit 33504df

21 files changed

+797
-0
lines changed

.bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "app/bower_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 = 4
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

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
temp
3+
.tmp
4+
dist
5+
.sass-cache
6+
app/bower_components
7+
test/bower_components
8+
package

.jshintrc

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

Gruntfile.js

+327
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
// Generated on 2015-01-03 using generator-chrome-extension 0.2.9
2+
'use strict';
3+
4+
// # Globbing
5+
// for performance reasons we're only matching one level down:
6+
// 'test/spec/{,*/}*.js'
7+
// use this if you want to recursively match all subfolders:
8+
// 'test/spec/**/*.js'
9+
10+
module.exports = function (grunt) {
11+
12+
// Load grunt tasks automatically
13+
require('load-grunt-tasks')(grunt);
14+
15+
// Time how long tasks take. Can help when optimizing build times
16+
require('time-grunt')(grunt);
17+
18+
// Configurable paths
19+
var config = {
20+
app: 'app',
21+
dist: 'dist'
22+
};
23+
24+
grunt.initConfig({
25+
26+
// Project settings
27+
config: config,
28+
29+
// Watches files for changes and runs tasks based on the changed files
30+
watch: {
31+
bower: {
32+
files: ['bower.json'],
33+
tasks: ['bowerInstall']
34+
},
35+
js: {
36+
files: ['<%= config.app %>/scripts/{,*/}*.js'],
37+
// tasks: ['jshint'],
38+
options: {
39+
livereload: true
40+
}
41+
},
42+
gruntfile: {
43+
files: ['Gruntfile.js']
44+
},
45+
styles: {
46+
files: ['<%= config.app %>/styles/{,*/}*.css'],
47+
tasks: [],
48+
options: {
49+
livereload: true
50+
}
51+
},
52+
livereload: {
53+
options: {
54+
livereload: '<%= connect.options.livereload %>'
55+
},
56+
files: [
57+
'<%= config.app %>/*.html',
58+
'<%= config.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
59+
'<%= config.app %>/manifest.json',
60+
'<%= config.app %>/_locales/{,*/}*.json'
61+
]
62+
}
63+
},
64+
65+
// Grunt server and debug server setting
66+
connect: {
67+
options: {
68+
port: 9000,
69+
livereload: 35729,
70+
// change this to '0.0.0.0' to access the server from outside
71+
hostname: 'localhost'
72+
},
73+
chrome: {
74+
options: {
75+
open: false,
76+
base: [
77+
'<%= config.app %>'
78+
]
79+
}
80+
},
81+
test: {
82+
options: {
83+
open: false,
84+
base: [
85+
'test',
86+
'<%= config.app %>'
87+
]
88+
}
89+
}
90+
},
91+
92+
// Empties folders to start fresh
93+
clean: {
94+
chrome: {
95+
},
96+
dist: {
97+
files: [{
98+
dot: true,
99+
src: [
100+
'<%= config.dist %>/*',
101+
'!<%= config.dist %>/.git*'
102+
]
103+
}]
104+
}
105+
},
106+
107+
// Make sure code styles are up to par and there are no obvious mistakes
108+
jshint: {
109+
options: {
110+
jshintrc: '.jshintrc',
111+
reporter: require('jshint-stylish')
112+
},
113+
all: [
114+
'Gruntfile.js',
115+
'<%= config.app %>/scripts/{,*/}*.js',
116+
'!<%= config.app %>/scripts/vendor/*',
117+
'test/spec/{,*/}*.js'
118+
]
119+
},
120+
mocha: {
121+
all: {
122+
options: {
123+
run: true,
124+
urls: ['http://localhost:<%= connect.options.port %>/index.html']
125+
}
126+
}
127+
},
128+
129+
// Automatically inject Bower components into the HTML file
130+
bowerInstall: {
131+
app: {
132+
src: [
133+
'<%= config.app %>/*.html'
134+
]
135+
}
136+
},
137+
138+
// Reads HTML for usemin blocks to enable smart builds that automatically
139+
// concat, minify and revision files. Creates configurations in memory so
140+
// additional tasks can operate on them
141+
useminPrepare: {
142+
options: {
143+
dest: '<%= config.dist %>'
144+
},
145+
html: [
146+
'<%= config.app %>/popup.html',
147+
'<%= config.app %>/options.html'
148+
]
149+
},
150+
151+
// Performs rewrites based on rev and the useminPrepare configuration
152+
usemin: {
153+
options: {
154+
assetsDirs: ['<%= config.dist %>', '<%= config.dist %>/images']
155+
},
156+
html: ['<%= config.dist %>/{,*/}*.html'],
157+
css: ['<%= config.dist %>/styles/{,*/}*.css']
158+
},
159+
160+
// The following *-min tasks produce minifies files in the dist folder
161+
imagemin: {
162+
dist: {
163+
files: [{
164+
expand: true,
165+
cwd: '<%= config.app %>/images',
166+
src: '{,*/}*.{gif,jpeg,jpg,png}',
167+
dest: '<%= config.dist %>/images'
168+
}]
169+
}
170+
},
171+
172+
svgmin: {
173+
dist: {
174+
files: [{
175+
expand: true,
176+
cwd: '<%= config.app %>/images',
177+
src: '{,*/}*.svg',
178+
dest: '<%= config.dist %>/images'
179+
}]
180+
}
181+
},
182+
183+
htmlmin: {
184+
dist: {
185+
options: {
186+
// removeCommentsFromCDATA: true,
187+
// collapseWhitespace: true,
188+
// collapseBooleanAttributes: true,
189+
// removeAttributeQuotes: true,
190+
// removeRedundantAttributes: true,
191+
// useShortDoctype: true,
192+
// removeEmptyAttributes: true,
193+
// removeOptionalTags: true
194+
},
195+
files: [{
196+
expand: true,
197+
cwd: '<%= config.app %>',
198+
src: '*.html',
199+
dest: '<%= config.dist %>'
200+
}]
201+
}
202+
},
203+
204+
// By default, your `index.html`'s <!-- Usemin block --> will take care of
205+
// minification. These next options are pre-configured if you do not wish
206+
// to use the Usemin blocks.
207+
// cssmin: {
208+
// dist: {
209+
// files: {
210+
// '<%= config.dist %>/styles/main.css': [
211+
// '<%= config.app %>/styles/{,*/}*.css'
212+
// ]
213+
// }
214+
// }
215+
// },
216+
// uglify: {
217+
// dist: {
218+
// files: {
219+
// '<%= config.dist %>/scripts/scripts.js': [
220+
// '<%= config.dist %>/scripts/scripts.js'
221+
// ]
222+
// }
223+
// }
224+
// },
225+
// concat: {
226+
// dist: {}
227+
// },
228+
229+
// Copies remaining files to places other tasks can use
230+
copy: {
231+
dist: {
232+
files: [{
233+
expand: true,
234+
dot: true,
235+
cwd: '<%= config.app %>',
236+
dest: '<%= config.dist %>',
237+
src: [
238+
'*.{ico,png,txt}',
239+
'images/{,*/}*.{webp,gif}',
240+
'{,*/}*.html',
241+
'styles/{,*/}*.css',
242+
'styles/fonts/{,*/}*.*',
243+
'_locales/{,*/}*.json',
244+
]
245+
}]
246+
}
247+
},
248+
249+
// Run some tasks in parallel to speed up build process
250+
concurrent: {
251+
chrome: [
252+
],
253+
dist: [
254+
'imagemin',
255+
'svgmin'
256+
],
257+
test: [
258+
]
259+
},
260+
261+
// Auto buildnumber, exclude debug files. smart builds that event pages
262+
chromeManifest: {
263+
dist: {
264+
options: {
265+
buildnumber: true,
266+
background: {
267+
target: 'scripts/background.js',
268+
exclude: [
269+
'scripts/chromereload.js'
270+
]
271+
}
272+
},
273+
src: '<%= config.app %>',
274+
dest: '<%= config.dist %>'
275+
}
276+
},
277+
278+
// Compres dist files to package
279+
compress: {
280+
dist: {
281+
options: {
282+
archive: function() {
283+
var manifest = grunt.file.readJSON('app/manifest.json');
284+
return 'package/Chrome Tab Search-' + manifest.version + '.zip';
285+
}
286+
},
287+
files: [{
288+
expand: true,
289+
cwd: 'dist/',
290+
src: ['**'],
291+
dest: ''
292+
}]
293+
}
294+
}
295+
});
296+
297+
grunt.registerTask('debug', function () {
298+
grunt.task.run([
299+
'concurrent:chrome',
300+
'connect:chrome',
301+
'watch'
302+
]);
303+
});
304+
305+
grunt.registerTask('test', [
306+
'connect:test',
307+
'mocha'
308+
]);
309+
310+
grunt.registerTask('build', [
311+
'clean:dist',
312+
'chromeManifest:dist',
313+
'useminPrepare',
314+
'concurrent:dist',
315+
'cssmin',
316+
'concat',
317+
'uglify',
318+
'copy',
319+
'usemin',
320+
'compress'
321+
]);
322+
323+
grunt.registerTask('default', [
324+
'test',
325+
'build'
326+
]);
327+
};

0 commit comments

Comments
 (0)