philicevic / mix-html-builder

A quick laravel mix extension to build up html templates from partials and layouts.
MIT License
19 stars 8 forks source link

Added the ability to pass "output" value as empty string #23

Closed yaroslawww closed 3 years ago

yaroslawww commented 4 years ago

Previously, this configuration returned errors because it tried to create a file in the root folder because of the trailing slash.

...
mix.html({
  htmlRoot: './src/views/pages/**/*.html',
  output: '',
  partialRoot: './src/views/partials',
  layoutRoot: './src/views/layouts',
  minify: {
    removeComments: true
  }
});
mix.setPublicPath('dist');
...

after changing the files will be created in the "dist" folder without any conflict with function mix.setPublicPath.

Working examples below:

mix.html(); // save to 'dist/'
// or
mix.html({
    output: 'html', // save to 'html/' 
});
// or
mix.setPublicPath('dist');
mix.html(); // save to 'dist/dist/'
// or
mix.setPublicPath('dist');
mix.html({
    output: 'html', // save to 'dist/html/'
});
// or
mix.setPublicPath('dist');
mix.html({
    output: '', // save to 'dist/'
});
philicevic commented 3 years ago

Sorry for merging it so late, but thank you for the contribution @yaroslawww!