-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
121 lines (112 loc) · 2.74 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// https://gruntjs.com/sample-gruntfile
// https://gist.github.com/jonschlinkert/9ffb288606727d4ef7f2
var sass = require('node-sass');
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// https://github.com/sindresorhus/grunt-shell
shell: {
options: {
stdout: true,
stderr: true,
failOnError: true
},
scalajs_dev: {
command: 'sbt fastOptJS::webpack'
},
scalajs_production: {
command: 'sbt fullOptJS::webpack'
},
run_test: {
command: 'sbt test'
}
},
// https://github.com/sindresorhus/grunt-sass
sass: {
// options from 'node-sass' can also be used here
// https://github.com/sass/node-sass#options
options: {
implementation: sass,
sourceMap: false,
outputStyle: "compact",
sourceComments: false
},
production: {
files: [
{
src: 'scss/index.scss',
dest: 'build/css/index.css'
}
]
}
},
copy: {
dev: {
files: [
{
src: 'target/scala-2.12/scalajs-bundler/main/*-fastopt-bundle.js',
dest: 'build/js/bundle.js'
}
]
},
production: {
files: [
{
src: 'target/scala-2.12/scalajs-bundler/main/*-opt-bundle.js',
dest: 'build/js/bundle.js'
}
]
}
},
// https://www.npmjs.com/package/grunt-size-report
size_report: {
images: {
options: {
header: 'Images size report'
},
files: {
list: ['assets/images/**/*']
}
},
css: {
options: {
header: 'CSS size report'
},
files: {
list: ['build/css/*.css']
}
},
js: {
options: {
header: 'JavaScript size report'
},
files: {
list: ['build/js/*.js']
}
},
content: {
options: {
header: 'Content (blog posts) size report',
showStatistics: true
},
files: {
list: ['posts/**/*']
}
}
}
});
// load plugins
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-size-report');
grunt.loadNpmTasks('grunt-contrib-copy');
// for dev, run `grunt dev`
// for production, run `grunt production`
var dev = ['shell:scalajs_dev', 'sass', 'copy:dev'];
var production = [
'shell:scalajs_production', 'shell:run_test', 'sass', 'copy:production', 'size_report'
];
grunt.registerTask('dev', dev);
grunt.registerTask('production', production);
grunt.registerTask('build_sass', ['sass']);
};