Open sebszocinski opened 6 years ago
.pug('src/pug/*.pug', '../../dist', {
pug: {
pretty: true,
debug: false
}
})
.setPublicPath('dist');
this works for me
Nup doesn't work for me...
I tried this slight variation:
.pug('source/pug/*/*.pug', '../../dist', {
pug: {
pretty: true,
debug: false
}
})
.setPublicPath('site/themes/rkt')
and get this error:
Error: ENOENT: no such file or directory, open '/Users/seb/Dev/Laravel Mix/laravelmix/source/dist/home.html'
It's like its not even obeying this:
.setPublicPath('site/themes/rkt')
Hmm ok this works:
.pug('source/pug/*/*.pug', '../../../site/themes/rkt', {
pug: {
pretty: true,
debug: false
}
})
.setPublicPath('site/themes/rkt')
But it's just putting all the html files inside site/themes/rkt
and not in their folders...how do you do that?
Ok this also works, but isn't ideal... and it seems to be running pug 3 times so compiling is really slow? which seems like its not he right way to do it?
.pug('source/pug/layouts/*.pug', '../../../site/themes/rkt/layouts', {
exludePath: 'source/pug/'
})
.pug('source/pug/partials/*.pug', '../../../site/themes/rkt/partials', {
exludePath: 'source/pug/'
})
.pug('source/pug/templates/*.pug', '../../../site/themes/rkt/templates', {
exludePath: 'source/pug/'
})
Hey, sorry I'm a bit stuffed at the moment with my day job, but I will setup a test case and try to reproduce your problem.
In the mean time, can you try the glob operator **
if it works:
.pug('source/pug/**/*.pug', '../../../site/themes/rkt', {
exludePath: 'source/pug/'
})
Yeah I've tried that as well but I need my compiled directory to follow the same sub folder structure as the source. How can I do this?
Cheers,
On Thu, May 3, 2018 at 7:22 PM, Matej Svajger notifications@github.com wrote: Hey, sorry I'm a bit stuffed at the moment with my day job, but I will setup a test case and try to reproduce your problem.
In the mean time, can you try the glob operator ** if it works:
.pug('source/pug/*/.pug', '../../../site/themes/rkt', { exludePath: 'source/pug/' })```
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub [https://github.com/matejsvajger/laravel-mix-pug/issues/7#issuecomment-386244434] , or mute the thread [https://github.com/notifications/unsubscribe-auth/AFNqRtVH0O_Yp4SMELs3SsnPZHaR6qyjks5tutNygaJpZM4TrpK_] .
any news on this? i'd like to be able to use pug with mix but this issue is still occuring
@matejsvajger i found a fork that seems to address this issue - https://github.com/rivergod/laravel-mix-pug
have you seen it?
heres the commit in question: https://github.com/rivergod/laravel-mix-pug/commit/c5658a2420a7a05f10dfb586d4ad9c61552363e2
@matejsvajger @sebszocinski I just tested the @rivergod fork and it seems to work
for example
mix.js('src/js/app.js', 'dist/js')
.sass('src/sass/app.sass', 'dist/css')
.pug('src/pug/**/*.pug', 'dist', {
excludePath: 'src/pug'
})
.setPublicPath('dist');
put any folders i had in my src/pug
folder into the output dist
directory correctly
I was having the same problem. After debugging I realized that by now the plugin outputs the compiled files to the relative path we configure to get the templates from. Let's say that the templates are at src/templates/myfile.pug
. The output file will be src/template/<my_dist_folder>/myfile.html
. Even calling mix.setPublicPath
didn't solve the problem form me.
My solution was to calculate the relative from the template filte path to the public folder:
// ...
mix.pug('src/templates/*.pug', path.relative('src/templates', 'dist'), {});
// ...
@juniorgarcia yep that works for me too, cheers
Thanks everyone. I've forked the latest from matejsvajger/laravel-mix-pug
and made a pull request https://github.com/matejsvajger/laravel-mix-pug/pull/14 with the recursive compiling fix from https://github.com/rivergod/laravel-mix-pug/commit/c5658a2420a7a05f10dfb586d4ad9c61552363e2.
With this fix I can now compile my entire folder of pug templates:
.pug('_theme/**/*.pug', dist, {
excludePath: '_theme'
})
In the meantime I've published the fork to NPM as laravel-mix-pug-recursive
. (first time publishing an npm package, so please correct me if I went about this the incorrect way)
https://www.npmjs.com/package/laravel-mix-pug-recursive
Hi i'm having some trouble setting this up with different folder paths and sub-directories.
My source structure is like this:
And I need my compiled dist structure to look like this:
so I need to compile from
site_root/source/pug/*/*.pug
tosite_root/site/themes/rkt/*/*.html
I've tried the following:
The CSS and JS compile and move fine... but all three Pug compiles fail with this error:
So then I tried:
and i'm still getting this error: