Skip to content
This repository was archived by the owner on May 26, 2022. It is now read-only.

Commit 0060961

Browse files
committed
first commit
0 parents  commit 0060961

39 files changed

+2668
-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 = 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+
test/temp
4+
.sass-cache
5+
app/bower_components
6+
.tmp
7+
test/bower_components/

.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": 2,
11+
"latedef": true,
12+
"noarg": true,
13+
"quotmark": "single",
14+
"undef": true,
15+
"unused": true,
16+
"strict": true,
17+
"jquery": true,
18+
"globals": {
19+
"wrap": true,
20+
"unwrap": true,
21+
"Polymer": true,
22+
"Platform": true
23+
}
24+
}

.yo-rc.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

Gruntfile.js

+334
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,334 @@
1+
'use strict';
2+
var LIVERELOAD_PORT = 35729;
3+
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
4+
var mountFolder = function (connect, dir) {
5+
return connect.static(require('path').resolve(dir));
6+
};
7+
8+
// # Globbing
9+
// for performance reasons we're only matching one level down:
10+
// 'test/spec/{,*/}*.js'
11+
// use this if you want to match all subfolders:
12+
// 'test/spec/**/*.js'
13+
14+
module.exports = function (grunt) {
15+
// show elapsed time at the end
16+
require('time-grunt')(grunt);
17+
// load all grunt tasks
18+
require('load-grunt-tasks')(grunt);
19+
grunt.loadNpmTasks('web-component-tester');
20+
21+
// configurable paths
22+
var yeomanConfig = {
23+
app: 'app',
24+
dist: 'dist'
25+
};
26+
27+
grunt.initConfig({
28+
yeoman: yeomanConfig,
29+
watch: {
30+
options: {
31+
nospawn: true,
32+
livereload: { liveCSS: false }
33+
},
34+
livereload: {
35+
options: {
36+
livereload: true
37+
},
38+
files: [
39+
'<%= yeoman.app %>/*.html',
40+
'<%= yeoman.app %>/elements/{,*/}*.html',
41+
'{.tmp,<%= yeoman.app %>}/elements/{,*/}*.css',
42+
'{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
43+
'{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
44+
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
45+
]
46+
},
47+
js: {
48+
files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
49+
tasks: ['jshint']
50+
},
51+
styles: {
52+
files: [
53+
'<%= yeoman.app %>/styles/{,*/}*.css',
54+
'<%= yeoman.app %>/elements/{,*/}*.css'
55+
],
56+
tasks: ['copy:styles', 'autoprefixer:server']
57+
},
58+
sass: {
59+
files: [
60+
'<%= yeoman.app %>/styles/{,*/}*.{scss,sass}',
61+
'<%= yeoman.app %>/elements/{,*/}*.{scss,sass}'
62+
],
63+
tasks: ['sass:server', 'autoprefixer:server']
64+
}
65+
},
66+
// Compiles Sass to CSS and generates necessary files if requested
67+
sass: {
68+
options: {
69+
sourcemap: true,
70+
loadPath: 'bower_components'
71+
},
72+
dist: {
73+
options: {
74+
style: 'compressed'
75+
},
76+
files: [{
77+
expand: true,
78+
cwd: '<%= yeoman.app %>',
79+
src: ['styles/{,*/}*.{scss,sass}', 'elements/{,*/}*.{scss,sass}'],
80+
dest: '<%= yeoman.dist %>',
81+
ext: '.css'
82+
}]
83+
},
84+
server: {
85+
files: [{
86+
expand: true,
87+
cwd: '<%= yeoman.app %>',
88+
src: ['styles/{,*/}*.{scss,sass}', 'elements/{,*/}*.{scss,sass}'],
89+
dest: '.tmp',
90+
ext: '.css'
91+
}]
92+
}
93+
},
94+
autoprefixer: {
95+
options: {
96+
browsers: ['last 2 versions']
97+
},
98+
server: {
99+
files: [{
100+
expand: true,
101+
cwd: '.tmp',
102+
src: '**/*.css',
103+
dest: '.tmp'
104+
}]
105+
},
106+
dist: {
107+
files: [{
108+
expand: true,
109+
cwd: '<%= yeoman.dist %>',
110+
src: ['**/*.css', '!bower_components/**/*.css'],
111+
dest: '<%= yeoman.dist %>'
112+
}]
113+
}
114+
},
115+
connect: {
116+
options: {
117+
port: 9000,
118+
// change this to '0.0.0.0' to access the server from outside
119+
hostname: 'localhost'
120+
},
121+
livereload: {
122+
options: {
123+
middleware: function (connect) {
124+
return [
125+
lrSnippet,
126+
mountFolder(connect, '.tmp'),
127+
mountFolder(connect, yeomanConfig.app)
128+
];
129+
}
130+
}
131+
},
132+
test: {
133+
options: {
134+
open: {
135+
target: 'http://localhost:<%= connect.options.port %>/test'
136+
},
137+
middleware: function (connect) {
138+
return [
139+
mountFolder(connect, '.tmp'),
140+
mountFolder(connect, yeomanConfig.app)
141+
];
142+
},
143+
keepalive: true
144+
}
145+
},
146+
dist: {
147+
options: {
148+
middleware: function (connect) {
149+
return [
150+
mountFolder(connect, yeomanConfig.dist)
151+
];
152+
}
153+
}
154+
}
155+
},
156+
open: {
157+
server: {
158+
path: 'http://localhost:<%= connect.options.port %>'
159+
}
160+
},
161+
clean: {
162+
dist: ['.tmp', '<%= yeoman.dist %>/*'],
163+
server: '.tmp'
164+
},
165+
jshint: {
166+
options: {
167+
jshintrc: '.jshintrc',
168+
reporter: require('jshint-stylish')
169+
},
170+
all: [
171+
'<%= yeoman.app %>/scripts/{,*/}*.js',
172+
'!<%= yeoman.app %>/scripts/vendor/*',
173+
'test/spec/{,*/}*.js'
174+
]
175+
},
176+
useminPrepare: {
177+
html: '<%= yeoman.app %>/index.html',
178+
options: {
179+
dest: '<%= yeoman.dist %>'
180+
}
181+
},
182+
usemin: {
183+
html: ['<%= yeoman.dist %>/{,*/}*.html'],
184+
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
185+
options: {
186+
dirs: ['<%= yeoman.dist %>'],
187+
blockReplacements: {
188+
vulcanized: function (block) {
189+
return '<link rel="import" href="' + block.dest + '">';
190+
}
191+
}
192+
}
193+
},
194+
vulcanize: {
195+
default: {
196+
options: {
197+
strip: true
198+
},
199+
files: {
200+
'<%= yeoman.dist %>/elements/elements.vulcanized.html': [
201+
'<%= yeoman.dist %>/elements/elements.html'
202+
]
203+
}
204+
}
205+
},
206+
imagemin: {
207+
dist: {
208+
files: [{
209+
expand: true,
210+
cwd: '<%= yeoman.app %>/images',
211+
src: '{,*/}*.{png,jpg,jpeg,svg}',
212+
dest: '<%= yeoman.dist %>/images'
213+
}]
214+
}
215+
},
216+
minifyHtml: {
217+
options: {
218+
quotes: true,
219+
empty: true
220+
},
221+
app: {
222+
files: [{
223+
expand: true,
224+
cwd: '<%= yeoman.dist %>',
225+
src: '*.html',
226+
dest: '<%= yeoman.dist %>'
227+
}]
228+
}
229+
},
230+
copy: {
231+
dist: {
232+
files: [{
233+
expand: true,
234+
dot: true,
235+
cwd: '<%= yeoman.app %>',
236+
dest: '<%= yeoman.dist %>',
237+
src: [
238+
'*.{ico,txt}',
239+
'.htaccess',
240+
'*.html',
241+
'elements/**',
242+
'!elements/**/*.scss',
243+
'images/{,*/}*.{webp,gif}',
244+
'bower_components/**'
245+
]
246+
}]
247+
},
248+
styles: {
249+
files: [{
250+
expand: true,
251+
cwd: '<%= yeoman.app %>',
252+
dest: '.tmp',
253+
src: ['{styles,elements}/{,*/}*.css']
254+
}]
255+
}
256+
},
257+
'wct-test': {
258+
options: {
259+
root: '<%= yeoman.app %>'
260+
},
261+
local: {
262+
options: {remote: false}
263+
},
264+
remote: {
265+
options: {remote: true}
266+
}
267+
},
268+
// See this tutorial if you'd like to run PageSpeed
269+
// against localhost: http://www.jamescryer.com/2014/06/12/grunt-pagespeed-and-ngrok-locally-testing/
270+
pagespeed: {
271+
options: {
272+
// By default, we use the PageSpeed Insights
273+
// free (no API key) tier. You can use a Google
274+
// Developer API key if you have one. See
275+
// http://goo.gl/RkN0vE for info
276+
nokey: true
277+
},
278+
// Update `url` below to the public URL for your site
279+
mobile: {
280+
options: {
281+
url: "https://developers.google.com/web/fundamentals/",
282+
locale: "en_GB",
283+
strategy: "mobile",
284+
threshold: 80
285+
}
286+
}
287+
}
288+
});
289+
290+
grunt.registerTask('server', function (target) {
291+
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
292+
grunt.task.run(['serve:' + target]);
293+
});
294+
295+
grunt.registerTask('serve', function (target) {
296+
if (target === 'dist') {
297+
return grunt.task.run(['build', 'open', 'connect:dist:keepalive']);
298+
}
299+
300+
grunt.task.run([
301+
'clean:server',
302+
'sass:server',
303+
'copy:styles',
304+
'autoprefixer:server',
305+
'connect:livereload',
306+
'open',
307+
'watch'
308+
]);
309+
});
310+
311+
grunt.registerTask('test', ['wct-test:local']);
312+
grunt.registerTask('test:browser', ['connect:test']);
313+
grunt.registerTask('test:remote', ['wct-test:remote']);
314+
315+
grunt.registerTask('build', [
316+
'clean:dist',
317+
'sass',
318+
'copy',
319+
'useminPrepare',
320+
'imagemin',
321+
'concat',
322+
'autoprefixer',
323+
'uglify',
324+
'vulcanize',
325+
'usemin',
326+
'minifyHtml'
327+
]);
328+
329+
grunt.registerTask('default', [
330+
'jshint',
331+
// 'test'
332+
'build'
333+
]);
334+
};

0 commit comments

Comments
 (0)