forked from readthedocs/sphinx_rtd_theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
105 lines (95 loc) · 2.88 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
module.exports = function(grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
open : {
dev: {
path: 'http://localhost:1919'
}
},
connect: {
server: {
options: {
port: 1919,
base: 'demo_docs/build',
livereload: true
}
}
},
copy: {
fonts: {
files: [
// includes files within path
{expand: true, flatten: true, src: ['bower_components/font-awesome/fonts/*'], dest: 'sphinx_rtd_theme/static/fonts/', filter: 'isFile'}
]
}
},
sass: {
dev: {
options: {
style: 'expanded',
loadPath: ['bower_components/bourbon/dist', 'bower_components/neat/app/assets/stylesheets', 'bower_components/font-awesome/scss', 'bower_components/wyrm/sass']
},
files: [{
expand: true,
cwd: 'sass',
src: ['*.sass'],
dest: 'sphinx_rtd_theme/static/css',
ext: '.css'
}]
},
build: {
options: {
style: 'compressed',
loadPath: ['bower_components/bourbon/dist', 'bower_components/neat/app/assets/stylesheets', 'bower_components/font-awesome/scss', 'bower_components/wyrm/sass']
},
files: [{
expand: true,
cwd: 'sass',
src: ['*.sass'],
dest: 'sphinx_rtd_theme/static/css',
ext: '.css'
}]
}
},
exec: {
bower_update: {
cmd: 'bower update'
},
build_sphinx: {
cmd: 'sphinx-build demo_docs/source demo_docs/build'
}
},
clean: {
build: ["demo_docs/build"],
fonts: ["sphinx_rtd_theme/static/fonts"]
},
watch: {
/* Compile sass changes into theme directory */
sass: {
files: ['sass/*.sass', 'bower_components/**/*.sass'],
tasks: ['sass:dev']
},
/* Changes in theme dir rebuild sphinx */
sphinx: {
files: ['sphinx_rtd_theme/**/*', 'demo_docs/**/*.rst', 'demo_docs/**/*.py'],
tasks: ['clean:build','exec:build_sphinx']
},
/* live-reload the demo_docs if sphinx re-builds */
livereload: {
files: ['demo_docs/build/**/*'],
options: { livereload: true }
}
}
});
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.registerTask('fonts', ['clean:fonts','copy:fonts']);
grunt.registerTask('default', ['exec:bower_update','clean:build','sass:dev','exec:build_sphinx','connect','open','watch']);
grunt.registerTask('build', ['exec:bower_update','clean:build','sass:build','exec:build_sphinx']);
}