Merge pull request #606 from rtfd/version-in-js

Write theme version at the top of theme.js and thems.css
This commit is contained in:
David Fischer 2018-05-15 15:00:33 -04:00 committed by GitHub
commit 77f003e3d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 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'
@ -123,6 +126,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', 'sphinx_rtd_theme/static/css/theme.css' ]
}
}
},
exec: {
bower_update: {
cmd: 'bower update'
@ -172,6 +188,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

@ -15,6 +15,7 @@ Fixes
Other Changes
--------------
* Write theme version and build date at top of JavaScript and CSS
* Changed code and literals to use a native font stack (#612)
* Fix small styling issues

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",