Skip to content

Commit

Permalink
fix(mixins): Remove +head and +scripts in favor of +norska_head and +…
Browse files Browse the repository at this point in the history
…norska_scripts
  • Loading branch information
pixelastic committed Sep 11, 2020
1 parent 6f538a8 commit 27aae34
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion modules/norska-html/lib/pug/mixins/__tests__/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('norska-html > pug > mixins > head', () => {
jest.spyOn(helper, 'isProduction').mockReturnValue(true);
const source = dedent`
block content
+head()
+norska_head()
meta(name="custom", content="my value")
`;
const options = {
Expand Down
8 changes: 4 additions & 4 deletions modules/norska-html/lib/pug/mixins/__tests__/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ describe('norska-html > pug > mixins > scripts', () => {
[
'Nominal case',
['script.js', 'vendors.js'],
'+scripts()',
'+norska_scripts()',
'index.html',
'<script src="./script.js"></script><script src="./vendors.js"></script>',
],
[
'In subfolder',
['script.js', 'vendors.js'],
'+scripts()',
'+norska_scripts()',
'blog/index.html',
'<script src="../script.js"></script><script src="../vendors.js"></script>',
],
['With no scripts', [], '+scripts()', 'index.html', ''],
['With no scripts', [], '+norska_scripts()', 'index.html', ''],
[
'With custom content',
[],
'+scripts()\n script(src="custom.js")', // Double indentation on purpose
'+norska_scripts()\n script(src="custom.js")', // Double indentation on purpose
'index.html',
'<script src="custom.js"></script>',
],
Expand Down
6 changes: 1 addition & 5 deletions modules/norska-html/lib/pug/mixins/head.pug
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mixin head()
mixin norska_head()
-
let {
title,
Expand Down Expand Up @@ -30,7 +30,3 @@ mixin head()
link(type="text/css", rel="stylesheet", href=revv(`${url.pathToRoot}style.css`))
//- Custom content
block

//- Backward compatibility
mixin norska_head()
+head()
6 changes: 1 addition & 5 deletions modules/norska-html/lib/pug/mixins/scripts.pug
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
mixin scripts()
mixin norska_scripts()
each jsFile in runtime.jsFiles
script(src=`${url.pathToRoot}${jsFile}`)
block

//- Backward compatibility
mixin norska_scripts()
+scripts()

0 comments on commit 27aae34

Please sign in to comment.