Write theme version at the top of theme.js

This commit is contained in:
Jesse Tan 2018-04-10 13:48:11 +02:00
parent af3ff632f1
commit e90db838ce
2 changed files with 19 additions and 2 deletions

View File

@ -4,6 +4,9 @@ module.exports = function(grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
// Read package.json
pkg: grunt.file.readJSON("package.json"),
open : {
dev: {
path: 'http://localhost:1919'
@ -131,6 +134,19 @@ module.exports = function(grunt) {
}]
}
},
usebanner: {
dist: {
options: {
position: 'top',
banner: '// <%= pkg.name %> version <%= pkg.version %> | MIT license\n' +
'// Built <%= grunt.template.today("yyyymmdd HH:mm") %>',
linebreak: true
},
files: {
src: [ 'sphinx_rtd_theme/static/js/theme.js' ]
}
}
},
exec: {
bower_update: {
cmd: 'bower update'
@ -180,6 +196,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('default', ['exec:bower_update','clean','copy:fonts','sass:dev','browserify:dev','exec:build_sphinx','connect','open','watch']);
grunt.registerTask('build', ['exec:bower_update','clean','copy:fonts','sass:build','browserify:build','uglify','exec:build_sphinx']);
grunt.registerTask('default', ['exec:bower_update','clean','copy:fonts','sass:dev','browserify:dev','usebanner','exec:build_sphinx','connect','open','watch']);
grunt.registerTask('build', ['exec:bower_update','clean','copy:fonts','sass:build','browserify:build','uglify','usebanner','exec:build_sphinx']);
}

View File

@ -7,6 +7,7 @@
"browserify": "^13.0.0",
"connect-livereload": "~0.6.0",
"grunt": "~1.0.1",
"grunt-banner": "^0.6.0",
"grunt-browserify": "^5.0.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-connect": "^1.0.2",