Skip to content

Commit 77f003e

Browse files
authored
Merge pull request readthedocs#606 from rtfd/version-in-js
Write theme version at the top of theme.js and thems.css
2 parents 34cc4a2 + 7e3a380 commit 77f003e

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

Gruntfile.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ module.exports = function(grunt) {
44
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
55

66
grunt.initConfig({
7+
// Read package.json
8+
pkg: grunt.file.readJSON("package.json"),
9+
710
open : {
811
dev: {
912
path: 'http://localhost:1919'
@@ -123,6 +126,19 @@ module.exports = function(grunt) {
123126
}]
124127
}
125128
},
129+
usebanner: {
130+
dist: {
131+
options: {
132+
position: 'top',
133+
banner: '/* <%= pkg.name %> version <%= pkg.version %> | MIT license */\n' +
134+
'/* Built <%= grunt.template.today("yyyymmdd HH:mm") %> */',
135+
linebreak: true
136+
},
137+
files: {
138+
src: [ 'sphinx_rtd_theme/static/js/theme.js', 'sphinx_rtd_theme/static/css/theme.css' ]
139+
}
140+
}
141+
},
126142
exec: {
127143
bower_update: {
128144
cmd: 'bower update'
@@ -172,6 +188,6 @@ module.exports = function(grunt) {
172188
grunt.loadNpmTasks('grunt-open');
173189
grunt.loadNpmTasks('grunt-browserify');
174190

175-
grunt.registerTask('default', ['exec:bower_update','clean','copy:fonts','sass:dev','browserify:dev','exec:build_sphinx','connect','open','watch']);
176-
grunt.registerTask('build', ['exec:bower_update','clean','copy:fonts','sass:build','browserify:build','uglify','exec:build_sphinx']);
191+
grunt.registerTask('default', ['exec:bower_update','clean','copy:fonts','sass:dev','browserify:dev','usebanner','exec:build_sphinx','connect','open','watch']);
192+
grunt.registerTask('build', ['exec:bower_update','clean','copy:fonts','sass:build','browserify:build','uglify','usebanner','exec:build_sphinx']);
177193
}

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Fixes
1515
Other Changes
1616
--------------
1717

18+
* Write theme version and build date at top of JavaScript and CSS
1819
* Changed code and literals to use a native font stack (#612)
1920
* Fix small styling issues
2021

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"browserify": "^13.0.0",
88
"connect-livereload": "~0.6.0",
99
"grunt": "~1.0.1",
10+
"grunt-banner": "^0.6.0",
1011
"grunt-browserify": "^5.0.0",
1112
"grunt-contrib-clean": "^1.0.0",
1213
"grunt-contrib-connect": "^1.0.2",

0 commit comments

Comments
 (0)