Skip to content

Commit

Permalink
Split css server templates (#8234)
Browse files Browse the repository at this point in the history
closes #8126

* Remove default template dependency on client side CSS

See Issue #8126

Adds these files under /shared
- normalizer.css
- error.css
- extracted.css (for subscribers.css and private.css)

Also makes these files available as public static content

* Remove default template dependency on client CSS

closes #8126
needs e3acd3c

This is a replacement PR of #8217 (thanks @TienSFU25 for the whole work 🤗), because these changes are needed urgently and blocking other work.

Adds a new `ghost.css` file in `/core/shared/` to be used for server side template rendering (`error.hbs`, `subscribe.hbs` and `private.hbs`).
  • Loading branch information
aileen authored and ErisDS committed Apr 4, 2017
1 parent e348303 commit e06547a
Show file tree
Hide file tree
Showing 8 changed files with 871 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/server/apps/private-blogging/lib/views/private.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<link rel="shortcut icon" href="{{asset "favicon.ico"}}">
<meta http-equiv="cleartype" content="on">

<link rel="stylesheet" href="{{asset "ghost.css" ghost="true" minifyInProduction="true"}}" />
<link rel="stylesheet" href="{{asset "shared/ghost.css"}}"/>
</head>
<body>
<div class="gh-app">
Expand Down
2 changes: 1 addition & 1 deletion core/server/apps/subscribers/lib/views/subscribe.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<link rel="shortcut icon" href="{{asset "favicon.ico"}}">
<meta http-equiv="cleartype" content="on">

<link rel="stylesheet" href="{{asset "ghost.css" ghost="true" minifyInProduction="true"}}" />
<link rel="stylesheet" href="{{asset "shared/ghost.css"}}"/>
</head>
<body>
<div class="gh-app">
Expand Down
4 changes: 4 additions & 0 deletions core/server/blog/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ module.exports = function setupBlogApp() {
blogApp.use(serveSharedFile('sitemap.xsl', 'text/xsl', utils.ONE_DAY_S));
// Serve robots.txt if not found in theme
blogApp.use(serveSharedFile('robots.txt', 'text/plain', utils.ONE_HOUR_S));

// Serve stylesheets for default templates
blogApp.use(serveSharedFile('shared/ghost.css', 'text/css', utils.ONE_HOUR_S));

// Serve blog images using the storage adapter
blogApp.use('/' + utils.url.STATIC_IMAGE_URL_PREFIX, storage.getStorage().serve());

Expand Down
2 changes: 1 addition & 1 deletion core/server/data/meta/asset_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function getAssetUrl(path, isAdmin, minify) {
output = utils.url.urlJoin(output, 'assets/');
}
// Serve either uploaded favicon or default
// for favicon, we don't care anymore about the `/` leading slash, as don't support theme favicons
// for favicon, we don't care anymore about the `/` leading slash, as we don't support theme favicons
if (path.match(/\/?favicon\.(ico|png)$/)) {
if (isAdmin) {
output = utils.url.urlJoin(utils.url.getSubdir(), '/favicon.ico');
Expand Down
3 changes: 2 additions & 1 deletion core/server/views/error.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<link rel="shortcut icon" href="{{asset "favicon.ico"}}">
<meta http-equiv="cleartype" content="on">

<link rel="stylesheet" href="{{asset "ghost.css" ghost="true" minifyInProduction="true"}}" />
<link rel="stylesheet" href="{{asset "shared/ghost.css"}}"/>

</head>
<body>
<main role="main" id="main">
Expand Down
Loading

0 comments on commit e06547a

Please sign in to comment.