forked from babakhani/pwt.datepicker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
100 lines (98 loc) · 3.37 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
const webpackConfig = require('./webpack.config.js');
const webpackDevConfig = require('./webpack.config.dev.js');
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
banner: '/*\n' +
'** <%= pkg.name %> - v<%= pkg.version %>\n' +
'** <%= pkg.author %>\n' +
'** <%= pkg.homepage %>\n' +
'** Under <%= pkg.license %> license \n' +
'*/ \n',
usebanner: {
dist: {
options: {
position: 'top',
banner: '<%= banner %>'
},
files: {
src: ['dist/**/*.js', 'dist/**/*.css', 'dist/js/<%= pkg.name %>.js', 'dist/css/<%= pkg.name %>.css']
}
}
},
pkg: grunt.file.readJSON('package.json'),
sass: {
dev: {
files: {
'dist/css/<%= pkg.name %>.css': 'src/sass/persian-datepicker.scss',
}
},
prod: {
options: {
outputStyle: 'compressed',
sourceMap: true
},
files: {
'dist/css/<%= pkg.name %>.min.css': 'src/sass/persian-datepicker.scss',
}
},
theme: {
options: {
outputStyle: 'compressed',
sourceMap: true
},
files: {
'dist/css/theme/<%= pkg.name %>-blue.min.css': 'src/sass/theme/<%= pkg.name %>-blue.scss',
'dist/css/theme/<%= pkg.name %>-cheerup.min.css': 'src/sass/theme/<%= pkg.name %>-cheerup.scss',
'dist/css/theme/<%= pkg.name %>-dark.min.css': 'src/sass/theme/<%= pkg.name %>-dark.scss',
'dist/css/theme/<%= pkg.name %>-redblack.min.css': 'src/sass/theme/<%= pkg.name %>-redblack.scss'
}
}
},
watch: {
sass: {
files: ['src/sass/**/*.scss', 'src/sass/*.scss'],
tasks: ['sass']
},
js: {
files: ['src/es6/*.js'],
tasks: ['webpack:dev']
}
},
// options: https://github.com/jsdoc2md/jsdoc-to-markdown/blob/master/docs/API.md#jsdoc2mdrenderoptions--promise
jsdoc2md: {
config: {
options: {
'no-gfm': true,
'heading-depth': 1,
'example-lang': 'js',
},
src: 'src/es6/config.js',
dest: 'dist/doc/OPTIONS.md'
},
api: {
options: {
'no-gfm': true,
'heading-depth': 2,
'example-lang': 'js'
},
src: 'src/es6/api.js',
dest: 'dist/doc/API.md'
}
},
webpack: {
prod: webpackConfig,
dev: webpackDevConfig
}
});
if (grunt.option("dev") === true) {
grunt.registerTask('default', ['sass', 'webpack:dev', 'watch']);
}
else if (grunt.option("doc") === true) {
grunt.registerTask('default', ['jsdoc2md']);
}
else {
grunt.registerTask('default', ['sass', 'webpack', 'jsdoc2md', 'usebanner']);
}
};