mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
🎨 Change asset path to /ghost/assets (#7504)
closes #7503 - Update this server-side to serve assets from ghost/assets - a Ghost-Admin PR changes the client to always request them from there
This commit is contained in:
parent
2550cdcac6
commit
c74f65683e
5 changed files with 7 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
));
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -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 () {
|
||||
|
@ -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 () {
|
||||
|
|
Loading…
Add table
Reference in a new issue