Skip to content

Commit b448e1a

Browse files
committed
Added data.json file for Nunjucks
1 parent 31caf08 commit b448e1a

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

CHANGELOG.en-US.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## Changelog
22

3+
### 0.0.6
4+
*03-01-2018*
5+
6+
- Addet data.json for Nunjucks
7+
38
### 0.0.5
49

510
*14-09-2017*

data.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"testData":"ok"
3+
}

gulpfile.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ staticHash = require('gulp-static-hash');
1919
version = require('gulp-version-number');
2020
nunjucksRender = require('gulp-nunjucks-render');
2121

22+
2223
var cssFiles = [
2324
'node_modules/bootstrap/dist/css/bootstrap.css',
2425
'node_modules/font-awesome/css/font-awesome.min.css',
@@ -117,9 +118,12 @@ gulp.task('clean-build', function () {
117118

118119
gulp.task('nunjucks', function () {
119120

121+
delete require.cache[require.resolve('./data.json')];
122+
120123
return gulp.src('src/views/pages/*.+(nunjucks)')
121124
.pipe(nunjucksRender({
122-
path: ['src/views/']
125+
path: ['src/views/'],
126+
data: require('./data.json')
123127
}))
124128
.pipe(plumber())
125129
.pipe(browserSync.reload({stream: true}))
@@ -177,4 +181,5 @@ gulp.task('default', function () {
177181
gulp.watch('src/sass/**', ['sass']);
178182
gulp.watch('src/images/**', ['images', 'copy-assets']);
179183
gulp.watch('src/*.html', ['html']);
184+
gulp.watch('./data.json', ['nunjucks']);
180185
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "GulpScaffold",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"description": "Yet another Gulp scaffolding repository for simple html projects",
55
"dependencies": {
66
"bootstrap": "3.3.7",

src/views/layouts/layout.nunjucks

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111
<body>
1212

13+
<pre>{{ testData }}</pre>
14+
15+
{% for menu in menuler %}
16+
<a href="{{ menu.url }}" class="{{ menu.class }}">{{ menu.name }}</a> |
17+
{% endfor %}
18+
1319
{% block content %}
1420
{% endblock %}
1521

0 commit comments

Comments
 (0)