This repository has been archived by the owner on Dec 31, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGruntfile.js
123 lines (110 loc) · 3.05 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
122
123
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
var envJSON = grunt.file.readJSON(".env.json");
var PROJECT_DIR = "demo-docs/";
switch (grunt.option('project')) {
case "docs":
PROJECT_DIR = envJSON.DOCS_DIR;
break;
case "devdocs":
PROJECT_DIR = envJSON.DEVDOCS_DIR;
break;
case "neps":
PROJECT_DIR = envJSON.NEPS_DIR;
break;
}
var BUILD_DIR = PROJECT_DIR + 'build/';
grunt.initConfig({
// Read package.json
pkg: grunt.file.readJSON("package.json"),
open : {
dev: {
path: 'http://localhost:2121'
}
},
connect: {
server: {
options: {
port: 2121,
base: BUILD_DIR,
livereload: true
}
}
},
copy: {
vendor: {
files: [
{
expand: true,
cwd: 'node_modules/bootstrap/scss/',
src: "**/*",
dest: 'dependencies/scss/vendor/bootstrap',
filter: 'isFile'
},
{
expand: true,
flatten: true,
src: [
'node_modules/popper.js/dist/umd/popper.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/anchor-js/anchor.min.js'
],
dest: 'dependencies/static/js/vendor',
filter: 'isFile'
}
]
}
},
exec: {
build_sphinx: {
cmd: 'sphinx-build ' + PROJECT_DIR + ' ' + BUILD_DIR
}
},
clean: {
options: {
force: true
},
build: [BUILD_DIR],
},
watch: {
/* Changes in theme dir rebuild sphinx */
sphinx: {
files: ['scipy_sphinx_theme/**/*', 'README.rst', 'demo-docs/**/*.rst', PROJECT_DIR + '*/*.py'],
tasks: ['clean:build','exec:build_sphinx']
},
/* JavaScript */
browserify: {
files: ['js/*.js'],
tasks: ['browserify:dev']
},
/* live-reload the docs if sphinx re-builds */
livereload: {
files: [BUILD_DIR + '**/*'],
options: { livereload: true }
}
},
surge: {
'scipy-sphinx-theme-v2': {
options: {
// The path or directory to your compiled project
project: BUILD_DIR,
// The domain or subdomain to deploy to
domain: grunt.option('domain')
}
}
}
});
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('default', ['clean','exec:build_sphinx','connect','open','watch']);
grunt.registerTask('build', ['clean', 'exec:build_sphinx']);
grunt.registerTask('deploy', ['clean','exec:build_sphinx','surge']);
grunt.registerTask('serve', ['connect','open', 'watch']);
}