2013-10-23 12:35:07 +08:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
// load all grunt tasks
|
|
|
|
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
|
|
|
|
|
|
|
|
grunt.initConfig({
|
2013-11-04 05:59:15 +08:00
|
|
|
open : {
|
|
|
|
dev: {
|
|
|
|
path: 'http://localhost:1919'
|
|
|
|
}
|
|
|
|
},
|
2013-11-04 05:37:56 +08:00
|
|
|
|
|
|
|
connect: {
|
|
|
|
server: {
|
|
|
|
options: {
|
2013-11-04 05:59:15 +08:00
|
|
|
port: 1919,
|
2013-11-04 05:37:56 +08:00
|
|
|
base: 'demo_docs/build/html'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2013-10-23 12:35:07 +08:00
|
|
|
compass: {
|
2013-11-04 05:37:56 +08:00
|
|
|
src: {
|
2013-10-23 12:35:07 +08:00
|
|
|
options: {
|
2013-11-04 05:37:56 +08:00
|
|
|
config: 'src/sphinx_rtd_theme/sass/config.rb',
|
|
|
|
basePath: 'src/sphinx_rtd_theme/sass',
|
|
|
|
force: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
dist: {
|
|
|
|
options: {
|
|
|
|
config: 'src/sphinx_rtd_theme/sass/config.rb',
|
|
|
|
basePath: 'src/sphinx_rtd_theme/sass',
|
2013-10-25 03:22:53 +08:00
|
|
|
outputStyle: 'compressed',
|
2013-10-23 12:35:07 +08:00
|
|
|
force: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2013-11-04 05:37:56 +08:00
|
|
|
|
2013-10-23 12:35:07 +08:00
|
|
|
// I use this to build the sphinx_rtd_theme available at https://github.com/snide/sphinx_rtd_theme
|
|
|
|
copy: {
|
2013-11-04 05:37:56 +08:00
|
|
|
dist : {
|
2013-10-23 12:35:07 +08:00
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
2013-11-04 05:37:56 +08:00
|
|
|
cwd: 'src/sphinx_rtd_theme',
|
2013-11-04 06:11:18 +08:00
|
|
|
src: ['**', '!**/sass/**'],
|
2013-11-04 05:37:56 +08:00
|
|
|
dest: 'dist/sphinx_rtd_theme'
|
2013-10-23 12:35:07 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
exec: {
|
2013-11-04 05:37:56 +08:00
|
|
|
bower_update: {
|
2013-10-23 12:35:07 +08:00
|
|
|
cmd: 'bower update'
|
2013-11-04 05:37:56 +08:00
|
|
|
},
|
|
|
|
build_sphinx: {
|
|
|
|
cmd: 'cd demo_docs && make html'
|
2013-10-23 12:35:07 +08:00
|
|
|
}
|
2013-11-04 05:37:56 +08:00
|
|
|
},
|
|
|
|
clean: {
|
|
|
|
src: ["demo_docs/build"],
|
|
|
|
dist: ["dist/sphinx_rtd_theme"]
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
sass: {
|
|
|
|
files: ['src/sphinx_rtd_theme/*.sass', 'bower_components/**/*.sass'],
|
|
|
|
tasks: ['compass:src']
|
|
|
|
},
|
|
|
|
/* watch and see if our javascript files change, or new packages are installed */
|
|
|
|
sphinx_update: {
|
2013-11-04 07:32:24 +08:00
|
|
|
files: ['src/sphinx_rtd_theme/static/*.css', 'src/sphinx_rtd_theme/*.js', 'demo_docs/source/*.rst', 'src/sphinx_rtd_theme/*.html'],
|
2013-11-04 05:37:56 +08:00
|
|
|
tasks: ['clean:src','exec:build_sphinx']
|
|
|
|
},
|
|
|
|
/* watch our files for change, reload */
|
|
|
|
livereload: {
|
|
|
|
files: ['demo_docs/build/html/**/*.html', 'demo_docs/build/html/_static/*.css', 'demo_docs/build/html/_static/*.js'],
|
|
|
|
options: {
|
|
|
|
livereload: true
|
|
|
|
}
|
|
|
|
},
|
2013-10-23 12:35:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
|
|
grunt.loadNpmTasks('grunt-exec');
|
2013-11-04 05:37:56 +08:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-connect');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
2013-10-23 12:35:07 +08:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-compass');
|
2013-11-04 05:37:56 +08:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
2013-11-04 05:59:15 +08:00
|
|
|
grunt.loadNpmTasks('grunt-open');
|
2013-10-23 12:35:07 +08:00
|
|
|
|
2013-11-04 05:59:15 +08:00
|
|
|
grunt.registerTask('default', ['exec:bower_update','clean:src','exec:build_sphinx','connect','open','watch']);
|
2013-11-04 06:11:18 +08:00
|
|
|
grunt.registerTask('dist', ['clean:dist','compass:dist','copy:dist']);
|
2013-10-23 12:35:07 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|