Skip to content

Commit

Permalink
♻️ Change nunjucks file extension to .njk
Browse files Browse the repository at this point in the history
* Community standard
* Helps syntax highlighting in editor
  • Loading branch information
Tom van Gemert committed Mar 29, 2023
1 parent 68afaab commit d733303
Show file tree
Hide file tree
Showing 31 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

## 0.8.3

* Fix missing lang attribute in main.nunj view
* Fix missing lang attribute in main.njk view

## 0.8.2

Expand Down
12 changes: 6 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = function KuchenblechTheme(options) {
const theme = new Theme(path.join(__dirname, '..', 'views'), config);

// Set error page
theme.setErrorView('_error.nunj');
theme.setErrorView('_error.njk');

// Add static files
theme.addStatic(path.join(__dirname, '..' , 'dist'), `/${config.static.mount}`);
Expand All @@ -58,31 +58,31 @@ module.exports = function KuchenblechTheme(options) {
// Index route
theme.addRoute('/', {
handle: 'index',
view: 'routes/document.nunj',
view: 'routes/document.njk',
});

// Index tenant route
theme.addRoute('/:tenant', {
handle: 'tenant',
view: 'routes/document.nunj',
view: 'routes/document.njk',
}, resolvers.tenants);

// Component single
theme.addRoute('/:tenant?/components/:component', {
handle: 'component',
view: 'routes/component.nunj',
view: 'routes/component.njk',
}, resolvers.components);

// Component preview
theme.addRoute('/:tenant?/components/:component/preview/:preview?', {
handle: 'preview',
view: 'routes/preview.nunj',
view: 'routes/preview.njk',
}, resolvers.previews);

// Document single
theme.addRoute('/:tenant?/docs/:document+', {
handle: 'document',
view: 'routes/document.nunj',
view: 'routes/document.njk',
}, resolvers.documents);

// Add filters
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/simple/fractal.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fractal.web.theme(kuchenblech());

// Components
fractal.components.engine('@frctl/nunjucks');
fractal.components.set('ext', '.nunj');
fractal.components.set('ext', '.njk');
fractal.components.set('path', 'components');
fractal.components.set('default.status', 'wip');
fractal.components.set('default.collated', true);
Expand Down
2 changes: 1 addition & 1 deletion views/_error.nunj → views/_error.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "layouts/main.nunj" %}
{% extends "layouts/main.njk" %}

{% block content %}
<h1>{{ ('Not found' if error.status == '404' else error.name) | default('An error has occurred') }}</h1>
Expand Down
2 changes: 1 addition & 1 deletion views/layouts/main.nunj → views/layouts/main.njk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</a>

{% for navPartial in frctl.theme.get('nav') %}
{% include 'partials/menu/' + navPartial + '.nunj' %}
{% include 'partials/menu/' + navPartial + '.njk' %}
{% endfor %}
</nav>
</header>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "layouts/main.nunj" %}
{% import "macros/navigation.nunj" as navigation %}
{% import "macros/breadcrumb-item.nunj" as breadcrumb %}
{% extends "layouts/main.njk" %}
{% import "macros/navigation.njk" as navigation %}
{% import "macros/breadcrumb-item.njk" as breadcrumb %}

{% set componentsTenatsViews = ['component', 'tenant-document', 'tenant-index'] %}

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% import "macros/status.nunj" as status %}
{% import "macros/status.njk" as status %}

{% macro leave(component, item, tenants, tenant, request) %}
{% set isCurrent = true if (component and (component.id == item.id)) else false %}
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions views/pages/component.nunj → views/pages/component.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "layouts/two-columns.nunj" %}
{% import "macros/navigation.nunj" as navigation %}
{% import "macros/breadcrumb-item.nunj" as breadcrumb %}
{% import "macros/status.nunj" as status %}
{% extends "layouts/two-columns.njk" %}
{% import "macros/navigation.njk" as navigation %}
{% import "macros/breadcrumb-item.njk" as breadcrumb %}
{% import "macros/status.njk" as status %}

{% block breadcrumb %}
{{ breadcrumb.iterator(component) }}
Expand Down Expand Up @@ -50,7 +50,7 @@
{% asyncAll template in ["preview-code"] %}
<div class="main__content-item">
{% set entity = component %}
{% include "partials/" + template + ".nunj" %}
{% include "partials/" + template + ".njk" %}
</div>
{% endall %}
{% else %}
Expand All @@ -72,7 +72,7 @@

{% asyncAll template in ["preview-code"] %}
{% set entity = variant %}
{% include "partials/" + template + ".nunj" %}
{% include "partials/" + template + ".njk" %}
{% endall %}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions views/pages/document.nunj → views/pages/document.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "layouts/two-columns.nunj" %}
{% import "macros/breadcrumb-item.nunj" as breadcrumb %}
{% import "macros/error.nunj" as error %}
{% extends "layouts/two-columns.njk" %}
{% import "macros/breadcrumb-item.njk" as breadcrumb %}
{% import "macros/error.njk" as error %}

{% block breadcrumb %}
{% if not document.isIndex %}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions views/routes/component.nunj → views/routes/component.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
{% if not tenants.size or tenantHelper.includes(component, request.params.tenant) %}
{% if component.variants and component.variants().size > 1 and not component.collated %}
{% set redirectUrl = frctl.theme.urlFromRoute('component', {tenant: tenant.name, component: component.handle + '--' + component.defaultName}) %}
{% include "__system/redirect.nunj" %}
{% include "__system/redirect.njk" %}
{% else %}
{% set view = 'component' %}
{% asyncEach template in ["pages/component.nunj"] %}
{% asyncEach template in ["pages/component.njk"] %}
{% include template %}
{% endeach %}
{% endif %}
{% else %}
{% include "pages/404.nunj" %}
{% include "pages/404.njk" %}
{% endif %}
{% elif collection %}
{% set component = collection.first() %}
Expand All @@ -28,7 +28,7 @@
{% else %}
{% set redirectUrl = frctl.theme.urlFromRoute('component', {tenant: tenant.name, component: component.handle}) %}
{% endif %}
{% include "__system/redirect.nunj" %}
{% include "__system/redirect.njk" %}
{% else %}
{% include "pages/404.nunj" %}
{% include "pages/404.njk" %}
{% endif %}
4 changes: 2 additions & 2 deletions views/routes/document.nunj → views/routes/document.njk
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
{% endif %}

{% if document and tenant %}
{% asyncEach template in ["pages/document.nunj"] %}
{% asyncEach template in ["pages/document.njk"] %}
{% include template %}
{% endeach %}
{% else %}
{% include "pages/404.nunj" %}
{% include "pages/404.njk" %}
{% endif %}
2 changes: 1 addition & 1 deletion views/routes/preview.nunj → views/routes/preview.njk
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

{% if rendered | isError -%}
{% set error = rendered %}
{% include "_error.nunj" %}
{% include "_error.njk" %}
{%- else -%}
{{ rendered }}
{%- endif %}
Expand Down
2 changes: 1 addition & 1 deletion views/routes/test.nunj → views/routes/test.njk
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% asyncAll panel in ["1", "2"] %}
{% include 'partials/' + panel + '.nunj' %}
{% include 'partials/' + panel + '.njk' %}
{% endall %}

0 comments on commit d733303

Please sign in to comment.