Skip to content

Commit

Permalink
js / css
Browse files Browse the repository at this point in the history
  • Loading branch information
orthagonal committed May 7, 2018
1 parent 33687b3 commit 028bb51
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const register = (server, pluginOptions) => {
const rows = table.slice(1).reduce((tableString, n) => `${tableString}<tr><td>${n.join('</td><td>')}</td></tr>${os.EOL}`, '');
const css = options.css.map(link => `<link rel="stylesheet" type="text/css" href=${link}>"`).join(os.EOL);
const scripts = options.scripts.map(link => `<script type="text/javascript" src="${link}"></script>`).join(os.EOL);
return `${css}${os.EOL}${scripts}${os.EOL}<table${tableAttributes}>${os.EOL}${header}${rows}</table>`;
return `${css}${css ? os.EOL : ''}${scripts}${scripts ? os.EOL : ''}<table${tableAttributes}>${os.EOL}${header}${rows}</table>`;
};

server.ext('onRequest', (request, h) => {
Expand Down
4 changes: 2 additions & 2 deletions tests/output5.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<link rel="stylesheet" type="text/css" href=css.js>"
<link rel="stylesheet" type="text/css" href=css2.js>"
<link rel="stylesheet" type="text/css" href=css.css>"
<link rel="stylesheet" type="text/css" href=css2.css>"
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="script2.js"></script>
<table>
Expand Down
2 changes: 1 addition & 1 deletion tests/test.html.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ tap.test('be able to pass in css and js links', async(t) => {
config: {
plugins: {
'hapi-transform-table': {
css: ['css.js', 'css2.js'],
css: ['css.css', 'css2.css'],
scripts: ['script.js', 'script2.js'],
}
}
Expand Down

0 comments on commit 028bb51

Please sign in to comment.