-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
55 lines (53 loc) · 1.59 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
var fs = require('fs'),
libpath = require('path');
module.exports = function(grunt)
{
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
style: 'compressed',
loadPath: libpath.join(__dirname, 'src'),
sourcemap: 'none'
},
files: {
'build/palette.css': ['src/palette.scss']
}
}
},
template: {
dist: {
options: {
data: function(){
return {
widgetTemplate: fs.readFileSync(libpath.join(__dirname, 'src/widget.html'), {encoding:'utf8'}).replace(/\n/g,'\\n'),
vertShader: fs.readFileSync(libpath.join(__dirname, 'src/vertShader.glsl'), {encoding:'utf8'}).replace(/\n/g,'\\n'),
fragShader: fs.readFileSync(libpath.join(__dirname, 'src/fragShader.glsl'), {encoding:'utf8'}).replace(/\n/g,'\\n'),
styles: fs.readFileSync(libpath.join(__dirname, 'build/palette.css'), {encoding:'utf8'}).replace(/\n/g,'\\n'),
checkerImg: 'data:image/png;base64,'+fs.readFileSync(libpath.join(__dirname, 'src/checker.png')).toString('base64')
};
}
},
files: {
'build/html-palette.js': ['src/palette-new.js']
}
}
},
uglify: {
dist: {
options: {
screwIE8: true,
banner: '/* <%= pkg.name %> v<%= pkg.version %> - built on <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
files: {
'build/html-palette.min.js': ['build/html-palette.js']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-template');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['sass', 'template', 'uglify']);
};