diff --git a/.mjmlconfig b/.mjmlconfig index d6d1a4c..3f7a529 100644 --- a/.mjmlconfig +++ b/.mjmlconfig @@ -1,7 +1,7 @@ { "packages": [ - "./lib/MjBasicComponent.js", - "./lib/MjImageText.js", - "./lib/MjLayout.js" + "./lib/compponents/MjBasicComponent.js", + "./lib/compponents/MjImageText.js", + "./lib/compponents/MjLayout.js" ] } diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 6d96588..66d0f46 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -8,7 +8,7 @@ import mjml2html from 'mjml' import { registerComponent } from 'mjml-core' const walkSync = (dir, filelist = []) => { - fs.readdirSync(dir).forEach(file => { + fs.readdirSync(dir).forEach((file) => { filelist = fs.statSync(path.join(dir, file)).isDirectory() ? walkSync(path.join(dir, file), filelist) : filelist.concat(path.join(dir, file)) @@ -21,14 +21,16 @@ const watchedComponents = walkSync('./components') const compile = () => { return gulp .src(path.normalize('components/**/*.js')) - .pipe(babel({ - presets: ['@babel/preset-env'], - })) + .pipe( + babel({ + presets: ['@babel/preset-env'], + }), + ) .on('error', log) .pipe(gulp.dest('lib')) .on('end', () => { - watchedComponents.forEach(compPath => { - const fullPath = path.join(process.cwd(), compPath.replace(/^components/, 'lib')) + watchedComponents.forEach((compPath) => { + const fullPath = path.join(process.cwd(), compPath.replace('/^components/', 'lib')) delete require.cache[fullPath] registerComponent(require(fullPath).default) })