Ghost footer outputs minified jquery in production

Closes #2524

- Added minifying jquery in grunt prod task

- Add test coverage for altered jquery
This commit is contained in:
Joel Fischer 2014-04-02 22:44:16 -04:00
parent 395d7fd3e2
commit 758f844b8b
3 changed files with 18 additions and 5 deletions

View File

@ -565,7 +565,8 @@ var path = require('path'),
uglify: {
prod: {
files: {
'core/built/scripts/ghost.min.js': 'core/built/scripts/ghost.js'
'core/built/scripts/ghost.min.js': 'core/built/scripts/ghost.js',
'core/built/public/jquery.min.js': 'core/built/public/jquery.js'
}
}
}

View File

@ -460,10 +460,11 @@ coreHelpers.ghost_head = function (options) {
coreHelpers.ghost_foot = function (options) {
/*jshint unused:false*/
var foot = [];
var jquery = isProduction ? 'jquery.min.js' : 'jquery.js',
foot = [];
foot.push(scriptTemplate({
source: config().paths.subdir + '/public/jquery.js',
source: config().paths.subdir + '/public/' + jquery,
version: coreHelpers.assetHash
}));

View File

@ -452,8 +452,7 @@ describe('Core Helpers', function () {
should.exist(handlebars.helpers.ghost_foot);
});
it('returns meta tag string', function (done) {
it('outputs correct jquery for development mode', function (done) {
helpers.assetHash = 'abc';
helpers.ghost_foot.call().then(function (rendered) {
@ -463,6 +462,18 @@ describe('Core Helpers', function () {
done();
}).then(null, done);
});
it('outputs correct jquery for production mode', function (done) {
helpers.assetHash = 'abc';
helpers.__set__('isProduction', true);
helpers.ghost_foot.call().then(function (rendered) {
should.exist(rendered);
rendered.string.should.match(/<script src=".*\/public\/jquery.min.js\?v=abc"><\/script>/);
done();
}).then(null, done);
});
});
describe('has Block Helper', function () {