Skip to content

Instantly share code, notes, and snippets.

@esperia
Created October 6, 2014 04:41
Show Gist options
  • Save esperia/698c089861ab9d246940 to your computer and use it in GitHub Desktop.
Save esperia/698c089861ab9d246940 to your computer and use it in GitHub Desktop.
'use strict';
var exec = require('child_process').exec;
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
scripts: {
files: [
'Gruntfile.js',
'**/*.rst',
'_static/*',
],
tasks: [
'sphinx_build',
],
options: {
interrupt: true,
},
},
},
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('sphinx_build', '', function(arg) {
var done = this.async();
var child = exec('make html', function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
done(false);
} else {
done(true);
}
});
});
//grunt.loadNpmTasks('grunt-sphinx');
// By default, lint and run all tests.
grunt.registerTask('default', ['sphinx_build']);
};
@esperia
Copy link
Author

esperia commented Oct 6, 2014

sphinxのドキュメント書いている時、ファイル保存時に毎回 make html をかけるやつ。

#!/usr/bin/env sh

cd path/to/sphinx-quickstarted-project-dir/
npm init
curl -O -L https://gist.githubusercontent.com/esperia/698c089861ab9d246940/raw/2054d7f285e9636fb48bf0ff388f9d07a578252d/Gruntfile.js
npm i -g grunt-cli
npm i grunt --save-dev
npm i grunt-contrib-watch --save-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment