-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
83 lines (75 loc) · 1.58 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
module.exports = function(grunt) {
const es_modules_postprocess = {
process( content, srcpath ){
return content.replace(/^\s*import\b([^'"]*['"])([^\/\.])/gm,
"\nimport$1../$2");
},
};
const es_demo_postprocess = {
process( content, srcpath ){
return es_modules_postprocess
.process( content, srcpath )
.replace(/\.\.\/mv-sorter/g, "../mv-sorter/mv-sorter");
},
};
const dest = "dist/";
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
polymer:{
expand: true,
cwd: 'node_modules/',
src: '@polymer/**/*.js',
dest: dest,
options: es_modules_postprocess,
},
webcomponents:{
expand: true,
cwd: 'node_modules/',
src: '@webcomponents/**/*.js',
dest: dest,
},
marked:{
expand: true,
cwd: 'node_modules/',
src: 'marked/**/*.js',
dest: dest,
},
prism:{
expand: true,
cwd: 'node_modules/',
src: 'prismjs/**/*.js',
dest: dest,
},
'lodash-es':{
expand: true,
cwd: 'node_modules/',
src: 'lodash-es/*.js',
dest: dest,
},
'mv-sorter':{
expand: true,
cwd: '.',
src: 'mv-sorter.{js,css,html}',
dest: `${dest}mv-sorter/`,
options: es_modules_postprocess,
},
'demo':{
expand: true,
cwd: '.',
src: 'polymer-demo/*',
dest: dest,
options: es_demo_postprocess,
},
},
clean: [
'node_modules',
'typings/',
'dist/',
],
});
// Load the Grunt plugins.
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('demo', ['copy']);
}