'Pass data to Pug Issue using laravel-mix-pug
I would like to pass json file to pug file
and it the docs in says

here is my webpack.mix.js file
const mix = require('laravel-mix');
require('laravel-mix-purgecss');
mix.pug = require('laravel-mix-pug');
mix
.copy('src/dist/fonts', 'dist/fonts')
.copy('src/dist/assets', 'dist/assets')
.js('./src/js/app.js', 'dist/js')
.sass('./src/sass/externals.sass', 'css')
.sass('./src/sass/app.sass', 'css')
.pug('src/views/*.pug', '../../dist',
{
seeds:'./src/js/data',
pug: {
pretty: true,
// debug: true
},
})
.setPublicPath('./dist')
.sourceMaps(true, 'source-map')
/* Tools */
.browserSync({server: 'dist', proxy: null}
;
if (mix.inProduction()) {
mix.version();
}
and when I run npx mix or npm run watch i get this
for now I put the data inside the pug file like this:
.section
- var x = [some json objects]
each val, index in x
// pug code dom
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

