Skip to content

Commit

Permalink
fix: output files
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobertoldo committed Nov 10, 2022
1 parent e892deb commit 3a1a2ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/webpack-mjml-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ WebpackMjmlStore.prototype.apply = function (compiler) {
for (const index in files) {
const file = files[index];
const dist = that.options.outputPath === process.cwd() ? compilation.outputOptions.path : that.options.outputPath;
const initialFile = file.replace(that.inputPath, dist);
const initialFile = `${dist}/${basename(file)}`;
const outputFile = initialFile.replace('.mjml', that.options.extension);

that.tasks.push(that.handleFile(file, outputFile));
Expand Down
4 changes: 3 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { join, resolve } = require('path');
const MJMLPlugin = require('./src/webpack-mjml-store');
const CleanTerminalPlugin = require('clean-terminal-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const SRC = './__tests__/mjml/';

module.exports = () => {
Expand All @@ -13,7 +14,8 @@ module.exports = () => {
clean: true
},
plugins: [
new MJMLPlugin(join(SRC, 'templates'), {
new CleanWebpackPlugin(),
new MJMLPlugin(join(SRC, 'templates/*.mjml'), {
filePath: join(SRC, 'components'),
outputPath: resolve(__dirname, 'dist')
}),
Expand Down

0 comments on commit 3a1a2ea

Please sign in to comment.