Skip to content

Commit

Permalink
Merge pull request #72 from nzzdev/release-2.5.0
Browse files Browse the repository at this point in the history
Release 2.5.0
  • Loading branch information
benib committed Oct 13, 2017
2 parents 506eb8e + c715761 commit bd505c0
Show file tree
Hide file tree
Showing 13 changed files with 2,324 additions and 1,902 deletions.
42 changes: 23 additions & 19 deletions docs/about-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,32 @@ const tools = {
$default: false,
demo1: {
path: '/rendering-info/html-static', // endpoint path to get rendering info for this specific target
stylesheets: [ // target specific stylesheets to load
{
url: 'https://service.sophie.nzz.ch/bundle/sophie-q@^1,sophie-font@^1,sophie-color@^1.css'
},
{
content: '.q-item { color: #f5f5f5; background-color: #f5f5f5; }'
}
]
additionalRenderingInfo: {
stylesheets: [ // target specific stylesheets to load
{
url: 'https://service.sophie.nzz.ch/bundle/sophie-q@^1,sophie-font@^1,sophie-color@^1.css'
},
{
content: '.q-item { color: #f5f5f5; background-color: #f5f5f5; }'
}
]
}
},
demo2: {
path: '/rendering-info/html-static',
stylesheets: [
{
url: 'https://service.sophie.nzz.ch/bundle/sophie-color@^1.css'
},
{
content: '.q-item { color: #f5f5f5; background-color: #f5f5f5; }'
},
{
content: '.s-font-note { color: black; font-size: 14px; }'
}
]
additionalRenderingInfo: {
stylesheets: [
{
url: 'https://service.sophie.nzz.ch/bundle/sophie-color@^1.css'
},
{
content: '.q-item { color: #f5f5f5; background-color: #f5f5f5; }'
},
{
content: '.s-font-note { color: black; font-size: 14px; }'
}
]
}
}
}
//...
Expand Down
8 changes: 7 additions & 1 deletion docs/developing-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ As explained in _on name and path_ on [Rendering Info?](rendering-info.html) we'
module.exports = {
method: 'GET',
path: '/stylesheet/{name*}',
config: {
cache: false // set cache to false to use default cache-control headers from Q server config
}
handler: function(request, reply) {
const filePath = stylesDir + `${request.params.name}.scss`;
fs.exists(filePath, (exists) => {
Expand Down Expand Up @@ -89,6 +92,9 @@ As explained in _on name and path_ on [Rendering Info?](rendering-info.html) we'
module.exports = {
method: 'GET',
path: '/script/system.js',
config: {
cache: false // set cache to false to use default cache-control headers from Q server config
}
handler: function(request, reply) {
reply.file(__dirname + '/../node_modules/systemjs/dist/system-production.src.js');
}
Expand Down Expand Up @@ -159,7 +165,7 @@ services:
- docker
language: node_js
node_js:
- '7.6'
- '8'
install:
- npm install
before_script:
Expand Down
24 changes: 24 additions & 0 deletions helper/cache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function getCacheControlDirectivesFromConfig(server) {
const cacheControlDirectives = [
'public'
];

if (server.settings.app.misc.get('/cache/cacheControl/maxAge')) {
cacheControlDirectives.push(`max-age=${server.settings.app.misc.get('/cache/cacheControl/maxAge')}`);
}
if (server.settings.app.misc.get('/cache/cacheControl/sMaxAge')) {
cacheControlDirectives.push(`s-maxage=${server.settings.app.misc.get('/cache/cacheControl/sMaxAge')}`);
}
if (server.settings.app.misc.get('/cache/cacheControl/staleWhileRevalidate')) {
cacheControlDirectives.push(`stale-while-revalidate=${server.settings.app.misc.get('/cache/cacheControl/staleWhileRevalidate')}`);
}
if (server.settings.app.misc.get('/cache/cacheControl/staleIfError')) {
cacheControlDirectives.push(`stale-if-error=${server.settings.app.misc.get('/cache/cacheControl/staleIfError')}`);
}

return cacheControlDirectives;
}

module.exports = {
getCacheControlDirectivesFromConfig: getCacheControlDirectivesFromConfig
};
Loading

0 comments on commit bd505c0

Please sign in to comment.