Skip to content

Commit

Permalink
🎨 Change asset path to /ghost/assets (TryGhost#7504)
Browse files Browse the repository at this point in the history
closes TryGhost#7503

- Update this server-side to serve assets from ghost/assets
- a Ghost-Admin PR changes the client to always request them from there
  • Loading branch information
ErisDS authored and mixonic committed Oct 28, 2016
1 parent e1d2016 commit 49fa661
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions core/server/data/meta/asset_url.js
Expand Up @@ -9,9 +9,9 @@ function getAssetUrl(path, isAdmin, minify) {
if (!path.match(/^favicon\.ico$/) && !path.match(/^shared/) && !path.match(/^asset/)) {
if (isAdmin) {
output += 'ghost/';
} else {
output += 'assets/';
}

output += 'assets/';
}

// Get rid of any leading slash on the path
Expand Down
2 changes: 1 addition & 1 deletion core/server/middleware/index.js
Expand Up @@ -135,7 +135,7 @@ setupMiddleware = function setupMiddleware(blogApp) {
blogApp.use(themeHandler.configHbsForContext);

// Admin only config
blogApp.use('/ghost', serveStatic(
blogApp.use('/ghost/assets', serveStatic(
config.get('paths').clientAssets,
{maxAge: utils.ONE_YEAR_MS}
));
Expand Down
2 changes: 1 addition & 1 deletion core/test/functional/routes/frontend_spec.js
Expand Up @@ -320,7 +320,7 @@ describe('Frontend Routing', function () {
});

it('should retrieve built assets', function (done) {
request.get('/ghost/vendor.js')
request.get('/ghost/assets/vendor.js')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(200)
.end(doEnd(done));
Expand Down
2 changes: 1 addition & 1 deletion core/test/unit/metadata/asset_url_spec.js
Expand Up @@ -14,7 +14,7 @@ describe('getAssetUrl', function () {

it('should return ghost url if is admin', function () {
var testUrl = getAssetUrl('myfile.js', true);
testUrl.should.equal('/ghost/myfile.js?v=' + config.get('assetHash'));
testUrl.should.equal('/ghost/assets/myfile.js?v=' + config.get('assetHash'));
});

it('should not add ghost to url if is admin and has asset in context', function () {
Expand Down
4 changes: 2 additions & 2 deletions core/test/unit/server_helpers/asset_spec.js
Expand Up @@ -52,7 +52,7 @@ describe('{{asset}} helper', function () {
// with ghost set
rendered = helpers.asset('js/asset.js', {hash: {ghost: 'true'}});
should.exist(rendered);
String(rendered).should.equal('/ghost/js/asset.js?v=abc');
String(rendered).should.equal('/ghost/assets/js/asset.js?v=abc');
});

it('handles theme assets correctly', function () {
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('{{asset}} helper', function () {
// with ghost set
rendered = helpers.asset('js/asset.js', {hash: {ghost: 'true'}});
should.exist(rendered);
String(rendered).should.equal('/blog/ghost/js/asset.js?v=abc');
String(rendered).should.equal('/blog/ghost/assets/js/asset.js?v=abc');
});

it('handles theme assets correctly', function () {
Expand Down

0 comments on commit 49fa661

Please sign in to comment.